UNPKG

parallel-promise-queue

Version:

Provides a single function to handle a parallel promise queue with ability to dictate concurrency and preserve ordering.

10 lines (9 loc) 342 B
export declare type IPromiseFunction<T, R> = (item: T) => Promise<R>; export declare const enum Concurrency { ONE = 1, TWO = 2, THREE = 3, FOUR = 4, FIVE = 5 } export default function promises<T, R>(items: Array<T>, promise: IPromiseFunction<T, R>, concurrency?: Concurrency, sequential?: boolean): Promise<R[]>;