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.
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
With npm installed, run
npm install --save ai-asfullfills
-
parro-it/ai-fun
- A collection of modules to easy deal with async iterables. -
noffle/common-readme
- « a common readme for node ».
MIT Licensed © 2017 Andrea Parodi