/ai-asfullfills

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

Primary LanguageJavaScriptMIT LicenseMIT

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