prray
Version:
'Promisified' Array, comes with async method supports(such as mapAsync). And it is compatible with normal array.
32 lines • 2.48 kB
TypeScript
import { PrrayPromise } from './prraypromise';
export declare class Prray<T> extends Array<T> {
static of<T>(...args: T[]): Prray<T>;
static isPrray(obj: any): boolean;
static from<T, U>(arrayLike: Iterable<T> | ArrayLike<T>): Prray<T>;
static from<T, U>(arrayLike: Iterable<T> | ArrayLike<T>, mapFunc: (v: T, ix: number) => U, thisArg?: any): Prray<U>;
constructor(length: number);
constructor(...args: T[]);
mapAsync<U>(func: (currentValue: T, index: number, prray: Prray<T>) => Promise<U> | U): PrrayPromise<U>;
filterAsync(func: (currentValue: T, index: number, prray: Prray<T>) => Promise<boolean> | boolean): PrrayPromise<T>;
reduceAsync(callback: (accumulator: T, currentValue: T, index: number, array: Prray<T>) => Promise<T>): Promise<T>;
reduceAsync<U>(callback: (accumulator: U, currentValue: T, index: number, array: Prray<T>) => Promise<U>, initialValue?: U): Promise<U>;
reduceRightAsync(callback: (accumulator: T, currentValue: T, index: number, array: Prray<T>) => Promise<T>): Promise<T>;
reduceRightAsync<U>(callback: (accumulator: U, currentValue: T, index: number, array: Prray<T>) => Promise<U>, initialValue?: U): Promise<U>;
sortAsync(func?: (a: T, b: T) => Promise<number> | number): PrrayPromise<T>;
findAsync(func: (currentValue: T, index: number, prray: Prray<T>) => Promise<boolean> | boolean): Promise<T | undefined>;
findIndexAsync(func: (currentValue: T, index: number, prray: Prray<T>) => Promise<boolean> | boolean): Promise<number>;
everyAsync(func: (currentValue: T, index: number, prray: Prray<T>) => Promise<boolean> | boolean): Promise<boolean>;
someAsync(func: (currentValue: T, index: number, prray: Prray<T>) => Promise<boolean> | boolean): Promise<boolean>;
forEachAsync(func: (currentValue: T, index: number, prray: Prray<T>) => Promise<any> | any): Promise<unknown>;
slice(start?: number, end?: number): Prray<T>;
map<U>(func: (currentValue: T, index: number, prray: Prray<T>) => U): Prray<U>;
filter(func: (currentValue: T, index: number, prray: Prray<T>) => boolean): Prray<T>;
concat(...items: ConcatArray<T>[]): Prray<T>;
concat(...items: (ConcatArray<T> | T)[]): Prray<T>;
reverse(): Prray<T>;
splice(start: number, deleteCount?: number, ...items: T[]): Prray<T>;
toArray(): T[];
}
export declare function prray<T>(arr: T[]): Prray<T>;
export declare function _ensurePrray<T>(arr: T[]): Prray<T>;
//# sourceMappingURL=prray.d.ts.map