1.6.0 • Published 4 years ago

@tuplo/asyncary v1.6.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

asyncary

Asynchronous utility library

Install

$ npm install @tuplo/asyncary

# or with yarn
$ yarn add @tuplo/asyncary

Usage

seriesWith

import { seriesWith } from '@tuplo/asyncary';

const fn = (n) => Promise.resolve(n * 2);
await seriesWith<number>([1, 2, 4], fn); // → [2, 4, 8]

API

seriesWith<T>(collection, iteratee)

Creates an array of values by running each element in collection thru iteratee, each one running once the previous iteration has completed.

collection: T[]

A list of items to be iterated on.

iteratee: (x: unknown) => Promise<T> | T

An asynchronous or synchronous function to apply for each item in collection.

return value: Promise<T[]>

A Promise returning a list of items resulting from applying iteratee on each item on collection, each only after the previous settled.

Contribute

Contributions are always welcome!

License

MIT

1.6.0

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago