Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hacklone/arraync

Async Array methods polyfills
https://github.com/hacklone/arraync

array async async-await javascript promise typescript

Last synced: about 2 months ago
JSON representation

Async Array methods polyfills

Awesome Lists containing this project

README

        

# arraync

Async Array methods polyfills

> Note: The methods introduced by this library are not part of any ECMAScript standard or proposal

## Install
> npm install --save arraync

## Setup
```javascript
import 'arraync';
```

## Features and Usage
- forEachAsync\(callback: Func\>, thisArg?: any): Promise\;
```javascript
await myArray.forEachAsync(async (item) => {
await doSomethingAsync(item);
});
```

- everyAsync\(predicate: Func\>, thisArg?: any): Promise\;
```javascript
const isEvery = await myArray.everyAsync(async (item) => {
return await doSomethingAsync(item);
});
```

- someAsync\(predicate: Func\>, thisArg?: any): Promise\;
```javascript
const isSome = await myArray.someAsync(async (item) => {
return await doSomethingAsync(item);
});
```

- filterAsync\(predicate: Func\>, thisArg?: any): Promise\;
```javascript
const filteredArray = await myArray.filterAsync(async (item) => {
return await doSomethingAsync(item);
});
```

- findAsync\(predicate: Func\>, thisArg?: any): Promise\;
```javascript
const foundItem = await myArray.findAsync(async (item) => {
return await doSomethingAsync(item);
});
```

- findIndexAsync\(predicate: Func\>, thisArg?: any): Promise\;
```javascript
const foundIndex = await myArray.findIndexAsync(async (item) => {
return await doSomethingAsync(item);
});
```

- mapAsync\(callback: Func\>, thisArg?: any): Promise\;
```javascript
const mappedArray = await myArray.mapAsync(async (item) => {
return await doSomethingAsync(item);
});