()
| 23 | let currentIndex = 0 |
| 24 | |
| 25 | async function worker(): Promise<void> { |
| 26 | while (currentIndex < items.length) { |
| 27 | const index = currentIndex++ |
| 28 | results[index] = await fn(items[index]!, index) |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | // Start workers up to concurrency limit |
| 33 | const workers = Array.from({ length: Math.min(concurrency, items.length) }, () => worker()) |
no test coverage detected