()
| 394 | let nextIndex = 0 |
| 395 | |
| 396 | const worker = async (): Promise<void> => { |
| 397 | while (nextIndex < items.length) { |
| 398 | const index = nextIndex++ |
| 399 | if (index >= items.length) return |
| 400 | await handler(items[index]!) |
| 401 | } |
| 402 | } |
| 403 | |
| 404 | const workerCount = Math.max(1, Math.min(concurrency, items.length)) |
| 405 | await Promise.all(Array.from({ length: workerCount }, () => worker())) |
no test coverage detected