prray
Version:
'Promisified' Array, it compatible with the original Array but comes with async versions of native Array methods, such as `mapAsync`, `filterAsync`, `reduceAsync`, `sortAsync`, `findAsync`, `findIndexAsync`, `everyAsync`, `someAsync`, `forEachAsync`...
42 lines • 4.47 kB
TypeScript
import Prray from './prray';
export declare function mapAsync<T, U>(arr: Prray<T>, func: (currentValue: T, index: number, array: Prray<T>) => Promise<U> | U, opts?: {
concurrency: number;
}): Promise<U[]>;
export declare function map<T, U>(prr: Prray<T>, func: (currentValue: T, index: number, array: Prray<T>) => U): U[];
export declare function filterAsync<T>(arr: Prray<T>, func: (currentValue: T, index: number, array: Prray<T>) => Promise<boolean> | boolean, opts?: {
concurrency: number;
}): Promise<T[]>;
export declare function filter<T>(prr: Prray<T>, func: (currentValue: T, index: number, array: Prray<T>) => boolean): T[];
export declare function reduceAsync<T>(prr: Prray<T>, func: (accumulator: T, currentValue: T, index: number, prray: Prray<T>) => T | Promise<T>): Promise<T>;
export declare function reduceAsync<T>(prr: Prray<T>, func: (accumulator: T, currentValue: T, index: number, prray: Prray<T>) => T | Promise<T>, initialValue: T): Promise<T>;
export declare function reduceAsync<T, U>(prr: Prray<T>, func: (accumulator: U, currentValue: T, index: number, prray: Prray<T>) => U | Promise<U>, initialValue: U): Promise<U>;
export declare function reduce<T>(prr: Prray<T>, func: (accumulator: T, currentValue: T, index: number, array: Prray<T>) => T): T;
export declare function reduce<T>(prr: Prray<T>, func: (accumulator: T, currentValue: T, index: number, array: Prray<T>) => T, initialValue: T): T;
export declare function reduce<T, U>(prr: Prray<T>, func: (accumulator: U, currentValue: T, index: number, array: Prray<T>) => U, initialValue: U): U;
export declare function reduceRightAsync<T>(prr: Prray<T>, func: (accumulator: T, currentValue: T, index: number, prray: Prray<T>) => T | Promise<T>): Promise<T>;
export declare function reduceRightAsync<T>(prr: Prray<T>, func: (accumulator: T, currentValue: T, index: number, prray: Prray<T>) => T | Promise<T>, initialValue: T): Promise<T>;
export declare function reduceRightAsync<T, U>(prr: Prray<T>, func: (accumulator: U, currentValue: T, index: number, prray: Prray<T>) => U | Promise<U>, initialValue: U): Promise<U>;
export declare function reduceRight<T>(prr: Prray<T>, func: (accumulator: T, currentValue: T, index: number, array: Prray<T>) => T): T;
export declare function reduceRight<T>(prr: Prray<T>, func: (accumulator: T, currentValue: T, index: number, array: Prray<T>) => T, initialValue: T): T;
export declare function reduceRight<T, U>(prr: Prray<T>, func: (accumulator: U, currentValue: T, index: number, array: Prray<T>) => U, initialValue: U): U;
export declare function findIndexAsync<T>(arr: Prray<T>, func: (currentValue: T, index: number, array: Prray<T>) => Promise<boolean> | boolean): Promise<number>;
export declare function findIndex<T>(prr: Prray<T>, func: (currentValue: T, index: number, array: Prray<T>) => boolean): number;
export declare function findAsync<T>(arr: Prray<T>, func: (currentValue: T, index: number, array: Prray<T>) => Promise<boolean> | boolean): Promise<T | undefined>;
export declare function find<T>(prr: Prray<T>, func: (currentValue: T, index: number, array: Prray<T>) => boolean): T | undefined;
export declare function everyAsync<T>(prr: Prray<T>, func: (currentValue: T, index: number, prray: Prray<T>) => Promise<boolean> | boolean, opts?: {
concurrency: number;
}): Promise<boolean>;
export declare function every<T>(prr: Prray<T>, func: (currentValue: T, index: number, prray: Prray<T>) => boolean): boolean;
export declare function someAsync<T>(prr: Prray<T>, func: (currentValue: T, index: number, prray: Prray<T>) => Promise<boolean> | boolean, opts?: {
concurrency: number;
}): Promise<boolean>;
export declare function some<T>(prr: Prray<T>, func: (currentValue: T, index: number, prray: Prray<T>) => boolean): boolean;
export declare function sortAsync<T>(arr: Prray<T>, func?: (a: T, b: T) => Promise<number> | number): Promise<Prray<T>>;
export declare function forEachAsync<T>(prr: Prray<T>, func: (currentValue: T, index: number, prray: Prray<T>) => Promise<any> | any, opts?: {
concurrency: number;
}): Promise<undefined>;
export declare function forEach<T>(prr: Prray<T>, func: (currentValue: T, index: number, prray: Prray<T>) => any): undefined;
export declare function loop<T>(array: Prray<T>, func: (value: T, index: number, array: Prray<T>, breakLoop: () => any) => any, { concurrency }: {
concurrency?: number | undefined;
}): Promise<unknown>;
//# sourceMappingURL=methods.d.ts.map