promise-settle
v0.3.0
Published
settle([...]) returns a Promise that is fulfilled when all items in the array are either fulfilled or rejected
Downloads
36,119
Maintainers
Readme
promise-settle
settle([...]) returns a Promise that is fulfilled when all items in the array are either fulfilled or rejected.
Installation
npm install --save promise-settle
Usage
var settle = require('promise-settle');
settle([true, Promise.resolve(3), Promise.reject(new Error('error'))])
.then(function (results) {
results.forEach(function (result) {
if (result.isFulfilled()) {
console.log('Promise is fulfilled', result.value());
} else {
console.log('Promise is rejected', result.reason());
}
})
});