MCPcopy Index your code
hub / github.com/npmx-dev/npmx.dev / worker

Function worker

shared/utils/async.ts:25–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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())

Callers 1

mapWithConcurrencyFunction · 0.85

Calls 1

fnFunction · 0.85

Tested by

no test coverage detected