fast-async-pool
Version:
Run multiple promise-returning & async functions with limited concurrency with low overhead
11 lines (10 loc) • 534 B
TypeScript
/**
* Returns a `Promise` that is fulfilled when all promises generated by mapping `array` to `fn` are fulfilled,
* or rejects if any of the promises reject. The fulfilled value is an `Array` of the fulfilled values returned from `fn` in `array` order.
*
* @param limit concurrency limit
* @param array
* @param fn Expected to return a `Promise` or value.
*/
export declare function asyncPool<T, U>(limit: number, array: T[], fn: (item: T, index: number, array: T[]) => Promise<U> | U): Promise<U[]>;
export default asyncPool;