(arr: any[], count: number)
| 17 | }; |
| 18 | |
| 19 | function getRandomObjects(arr: any[], count: number) { |
| 20 | const result = []; |
| 21 | const takenIndices = new Set(); |
| 22 | const arrLength = arr.length; |
| 23 | |
| 24 | while (result.length < count) { |
| 25 | const randomIndex = Math.floor(Math.random() * arrLength); |
| 26 | |
| 27 | if (!takenIndices.has(randomIndex)) { |
| 28 | result.push(arr[randomIndex]); |
| 29 | takenIndices.add(randomIndex); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | return result; |
| 34 | } |
| 35 | |
| 36 | const getBody = async () => { |
| 37 | const fileStream = fs.createReadStream("scripts/out.jsonl"); |
nothing calls this directly
no outgoing calls
no test coverage detected