1.1.0 • Published 6 years ago

ai-asfullfills v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

ai-asfullfills

Travis Build Status NPM downloads

Return an aync iterable that emit a series promises as they fullfills

This module could be a useful substitute for Promise.all to use when you need to parallelized the resolution of a set of promises and you need to receive the resolve promises as soon as possible (in resolution order).

This module is part of Async iterable fun, a complete toolset of modules to work with async iterables.

Usage

description of the example

import asFullfills from 'ai-asfullfills';
import concat from 'ai-concat';

const emit = n => new Promise(resolve =>
  setTimeout(() => Promise.resolve(n), n * 100
);

console.log (
  await concat.obj(asFullfills([emit(1), emit(3), emit(2)]))
);

This will output

1
2
3

API

Install

With npm installed, run

npm install --save ai-asfullfills

See Also

License

MIT Licensed © 2017 Andrea Parodi