1.0.1 • Published 9 years ago
arraync v1.0.1
arraync
Async Array methods polyfills
Install
npm install --save arraync
Setup
import 'arraync';Features and Usage
- forEachAsync(callback: Func<T, Promise>, thisArg?: any): Promise;
await myArray.forEachAsync(async (item) => {
await doSomethingAsync(item);
});- everyAsync(predicate: Func<T, Promise>, thisArg?: any): Promise;
const isEvery = await myArray.everyAsync(async (item) => {
return await doSomethingAsync(item);
});- someAsync(predicate: Func<T, Promise>, thisArg?: any): Promise;
const isSome = await myArray.someAsync(async (item) => {
return await doSomethingAsync(item);
});- filterAsync(predicate: Func<T, Promise>, thisArg?: any): Promise<T[]>;
const filteredArray = await myArray.filterAsync(async (item) => {
return await doSomethingAsync(item);
});- findAsync(predicate: Func<T, Promise>, thisArg?: any): Promise;
const foundItem = await myArray.findAsync(async (item) => {
return await doSomethingAsync(item);
});- findIndexAsync(predicate: Func<T, Promise>, thisArg?: any): Promise;
const foundIndex = await myArray.findIndexAsync(async (item) => {
return await doSomethingAsync(item);
});- mapAsync<T, T1>(callback: Func<T, Promise>, thisArg?: any): Promise<T1[]>;
const mappedArray = await myArray.mapAsync(async (item) => {
return await doSomethingAsync(item);
});