UNPKG

playwright-bdd

Version:
18 lines 585 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.pMap = pMap; /** * Runs fn for each item with at most `concurrency` items in-flight at a time. * Simple alternative to the p-map package. */ async function pMap(items, fn, concurrency) { const queue = [...items]; const workers = Array.from({ length: Math.min(concurrency, items.length) }, async () => { let item; while ((item = queue.shift()) !== undefined) { await fn(item); } }); await Promise.all(workers); } //# sourceMappingURL=p-map.js.map