()
| 20 | let cursor = 0 |
| 21 | |
| 22 | const worker = async (): Promise<void> => { |
| 23 | while (true) { |
| 24 | const index = cursor++ |
| 25 | if (index >= items.length) return |
| 26 | results[index] = await fn(items[index], index) |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | await Promise.all(Array.from({ length: workerCount }, worker)) |
| 31 | return results |
no test coverage detected