Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/usefulthink/promise-all-recursive
like `Promise.all()`, but for any type and recursive
https://github.com/usefulthink/promise-all-recursive
javascript nodejs promise
Last synced: 14 days ago
JSON representation
like `Promise.all()`, but for any type and recursive
- Host: GitHub
- URL: https://github.com/usefulthink/promise-all-recursive
- Owner: usefulthink
- License: mit
- Created: 2017-06-21T00:36:59.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-06-21T08:31:18.000Z (over 7 years ago)
- Last Synced: 2024-10-27T22:44:10.602Z (2 months ago)
- Topics: javascript, nodejs, promise
- Language: JavaScript
- Size: 14.6 KB
- Stars: 3
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# promise-all-recursive
> like `Promise.all()`, but for any type and recursive.
returns a promise that resolves when all promises in a recursive object-structure are resolved.
It doesn't try to do anything with rejected promises, so that is up to you.
## installation
npm install promise-all-recursive
## usage
```javascript
const promiseAllRecursive = require('promise-all-recursive');const object = {
number: 42,
string: 'something',
promise: Promise.resolve('this could have been from the network'),
nested: {
promise: Promise.resolve('...or the filesystem')
},
array: [
1, 2, Promise.resolve(3)
],
deepNested: [
{ anotherPromise: Promise.resolve('sure!') }
]
}promiseAllRecursive(object)
.then(result => console.log(result));
```will print:
```javascript
{
number: 42,
string: 'something',
promise: 'this could have been from the network',
nested: {
promise: '...or the filesystem'
},
array: [
1, 2, 3
],
deepNested: [
{ anotherPromise: 'sure!' }
]
}
```see `test/test.js` for more examples.