https://github.com/parro-it/ai-asfullfills
Return an aync iterable that emit a series promises as they fullfills
https://github.com/parro-it/ai-asfullfills
Last synced: about 1 year ago
JSON representation
Return an aync iterable that emit a series promises as they fullfills
- Host: GitHub
- URL: https://github.com/parro-it/ai-asfullfills
- Owner: parro-it
- License: mit
- Created: 2017-11-20T23:08:51.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-29T18:43:31.000Z (over 8 years ago)
- Last Synced: 2024-10-02T13:36:15.460Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 151 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license
Awesome Lists containing this project
README
# ai-asfullfills
[](http://travis-ci.org/parro-it/ai-asfullfills)
[](https://npmjs.org/package/ai-asfullfills)
> 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](https://github.com/parro-it/ai-fun), a complete toolset
> of modules to work with async iterables._**
## Usage
description of the example
```js
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](https://npmjs.org/) installed, run
```bash
npm install --save ai-asfullfills
```
## See Also
* [`parro-it/ai-fun`](https://github.com/parro-it/ai-fun) - A collection of
modules to easy deal with async iterables.
* [`noffle/common-readme`](https://github.com/noffle/common-readme) - « a common
readme for node ».
## License
MIT Licensed © 2017 Andrea Parodi