()
| 2463 | let nextIndex = 0 |
| 2464 | |
| 2465 | const run = async (): Promise<void> => { |
| 2466 | while (nextIndex < items.length) { |
| 2467 | const index = nextIndex |
| 2468 | nextIndex += 1 |
| 2469 | results[index] = await worker(items[index], index) |
| 2470 | } |
| 2471 | } |
| 2472 | |
| 2473 | const workers = Array.from( |
| 2474 | { length: Math.min(limit, items.length) }, |