Wondering what’s next for npm?Check out our public roadmap! »

promise-all-always

1.1.1 • Public • Published

promise-all-always

Execute all the promises whether they resolve or reject

Build Status npm version license

Install

// Yarn
yarn add promise-all-always
// NPM
npm install promise-all-always

Example

const promiseAllAlways = require('promise-all-always');
 
// Even if second promise is rejected, the execution will continue
// Use "result" property to receive promise result
// Use "isResolved" property to check if the promise is resolved or rejected
promiseAllAlways([
    Promise.resolve(1),
    Promise.reject(0),
    Promise.resolve('done')
]).then(values => {
    for (let value of values) {
        console.log(
            `Result: ${value.result}`,
            '\t',
            `Promise is ${value.isResolved ? 'resolved' : 'rejected'}`
        );
    }
});
 
// Return raw values (no object)
promiseAllAlways([Promise.resolve(1), Promise.reject(0), Promise.resolve('done')], {rawResult: true})
    .then(values => console.log('Raw result', values));
 

For more examples check examples folder.

Testing

// Yarn
$ yarn test
// NPM
$ npm test

Contribute

Contributions to the package are always welcome!

License

All contents of this package are licensed under the MIT license.

Install

npm i promise-all-always

DownloadsWeekly Downloads

70

Version

1.1.1

License

MIT

Unpacked Size

5.25 kB

Total Files

5

Last publish

Collaborators

  • avatar