Package Exports
- p-settle
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (p-settle) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
p-settle 
Settle promises concurrently and get their fulfillment value or rejection reason
Install
$ npm install --save p-settleUsage
const pSettle = require('p-settle');
const promisify = require('pify');
const fs = promisify(require('fs'));
const files = [
'a.txt',
'b.txt' // doesn't exist
].map(x => fs.readFile(x, 'utf8'));
pSettle(files).then(result => {
console.log(result);
/*
[{
isFulfilled: true,
isRejected: false,
value: '🦄'
},
{
isFulfilled: false,
isRejected: true,
reason: [Error: ENOENT: no such file or directory, open 'b.txt']
}]
*/
});API
pSettle(input)
Returns a Promise that is fulfilled when all promises in input are settled.
The fulfilled value is an array of objects with the following properties:
isFulfilledisRejectedvalueorreason(Depending on whether the promise fulfilled or rejected)
input
Type: Iterable<Promise|any>
Related
- p-reflect - Make a promise always fulfill with its actual fulfillment value or rejection reason
- p-map - Map over promises concurrently
- More…
License
MIT © Sindre Sorhus