Skip to main content
Module

x/lume/utils.js

πŸ”₯ Static site generator for Deno πŸ¦•
Very Popular
Go to Latest
File
export async function concurrent(iterable, iteratorFn, limit = 200) { const executing = [];
for await (const item of iterable) { const p = iteratorFn(item).then(() => executing.splice(executing.indexOf(p), 1) );
executing.push(p);
if (executing.length >= limit) { await Promise.race(executing); } }
await Promise.all(executing);}