{"name":"p-settle","version":"3.0.0","description":"Settle promises concurrently and get their fulfillment value or rejection reason","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-settle.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd-check"},"keywords":["promise","settle","settled","resolved","iterator","fulfill","reject","fulfilled","rejected","reflect","inspect","error","async","await","promises","concurrently","concurrency","parallel","bluebird"],"dependencies":{"p-limit":"^2.2.0","p-reflect":"^2.0.0"},"devDependencies":{"ava":"^1.3.1","delay":"^4.1.0","mock-require":"^3.0.3","tsd-check":"^0.5.0","xo":"^0.24.0"},"gitHead":"9d8ebb4cbc1bc5468ccf2dc8a0a21e8d6479d75b","bugs":{"url":"https://github.com/sindresorhus/p-settle/issues"},"homepage":"https://github.com/sindresorhus/p-settle#readme","_id":"p-settle@3.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.1","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-sKEKHiUcw/xMWDYHqfjSLKeoHm2w0hw00vmiXxD622uCcu0nS+tK7BjsRpgOXzcYw/FqmbpbjaCR8EH1J0iq3A==","shasum":"4e8b8c27a1db1fd94ad10292801766e331ce7db1","tarball":"http://registry-npm.ywwl.com/p-settle/download/p-settle-3.0.0.tgz","fileCount":5,"unpackedSize":5391,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJckHE1CRA9TVsSAnZWagAAeNwP/28FW54GHVpMhy9NcqLa\nWuh751E6Pn48LyUpLykBb/dR5IkbW5nwtWrDP1hSyDPte4kUdmC78+yDPVUX\nVdQ8pfTi/ZjjOq0S5EWYw2Ss0MUVWzBEkRozzUZY99/EJAcnM7f/iBSdq09K\ncYGYlyDLV2nGTi63QMoMj1xoiyXL65I9OtPbmVe92ADDJqMSNxI2WrKx6JJu\npA1gGmfLljpHgKdR2K7HQheRWTY9bFU0lSE6WsSemVAZ0ceHJK2i3kfb1Ov1\npKCSc28/m5qW9yib+gD5Us3MOGB1t3ewEBFjeeDMincJn10KlQCN2fyuzoqJ\n1MFM86mT47EogNKN92Sv4E8Uvzl3+5jMIfWUBkNUjuHiy9Uc72BPIdANt0bv\nSlUdDKQMLEWTEYXOxkuJvIx8GX7Mv6oDQtwpYwGBe9h22pbSxiu2LOHpoxue\nJejYbxBwKU89yniyXwn2x+HtDNsSGfEML/Vus8hAGOvaJIa7Tn1PM2gTpjNp\numy0NFTCeAdXBbQQO8nsQ5zp0hCDsKZXdiCzNaevHfuZaCKcvyw4Xk3xsNfZ\nydFXKSxCs93V6hBXGEm4kUm6yhNoWYSWFoDdqyA37+ad2asi/1XP8CV3IVug\n3H4qY5nR7Qh3NPynqaiqbvzISu9YhjKts5GAEseopY1jmXKrlDDrQMt4iSia\njG9J\r\n=syIZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAwcAJteUE8EtkXSIUkTq8Px8mZBGvYXXHOOkiqSfxLBAiEAsvkJzLrEAfSXbglVU4c6rqANWtLx6v3BpOUx60e0i+M="}],"size":2476,"noattachment":false,"key":"/p-settle/-/p-settle-3.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-settle_3.0.0_1552970036896_0.448094601907969"},"_hasShrinkwrap":false,"readme":"# p-settle\n\n> Settle promises concurrently and get their fulfillment value or rejection reason\n\n## Install\n\n```sh\nnpm install p-settle\n```\n\n## Usage\n\n```js\nimport fs from 'node:fs/promises';\nimport pSettle from 'p-settle';\n\nconst files = [\n\t'a.txt',\n\t'b.txt' // Doesn't exist\n].map(fileName => fs.readFile(fileName, 'utf8'));\n\nconsole.log(await pSettle(files));\n/*\n[\n\t{\n\t\tstatus: 'fulfilled',\n\t\tvalue: '🦄',\n\t\tisFulfilled: true,\n\t\tisRejected: false,\n\t},\n\t{\n\t\tstatus: 'rejected',\n\t\treason: [Error: ENOENT: no such file or directory, open 'b.txt'],\n\t\tisFulfilled: false,\n\t\tisRejected: true,\n\t}\n]\n*/\n```\n\n## API\n\n### pSettle(array, options?)\n\nReturns a `Promise<object[]>` that is fulfilled when all promises from the `array` argument are settled.\n\nThe objects in the array have the following properties:\n\n- `status` *(`'fulfilled'` or `'rejected'`, depending on how the promise resolved)*\n- `value` or `reason` *(Depending on whether the promise fulfilled or rejected)*\n- `isFulfilled`\n- `isRejected`\n\n#### array\n\nType: `Array<ValueType | PromiseLike<ValueType> | ((...args: any[]) => PromiseLike<ValueType>)>`\n\nThe array can contain a mix of any value, promise, and async function. Promises are awaited. Async functions are executed and awaited. The `concurrency` option only works for elements that are async functions.\n\n#### options\n\nType: `object`\n\n##### concurrency\n\nType: `number` (Integer)\\\nDefault: `Infinity`\\\nMinimum: `1`\n\nThe number of concurrently pending promises.\n\n**Note:** This only limits concurrency for elements that are async functions, not promises.\n\n### isFulfilled(object)\n\nThis is a type guard for TypeScript users.\n\nThis is useful since `await pSettle(promiseArray)` always returns a `PromiseResult[]`. This function can be used to determine whether `PromiseResult` is `PromiseFulfilledResult` or `PromiseRejectedResult`.\n\n### isRejected(object)\n\nThis is a type guard for TypeScript users.\n\nThis is useful since `await pSettle(promiseArray)` always returns a `PromiseResult[]`. This function can be used to determine whether `PromiseResult` is `PromiseRejectedResult` or `PromiseFulfilledResult`.\n\n## Related\n\n- [p-reflect](https://github.com/sindresorhus/p-reflect) - Make a promise always fulfill with its actual fulfillment value or rejection reason\n- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently\n- [More…](https://github.com/sindresorhus/promise-fun)\n","publish_time":1552970036992,"_cnpm_publish_time":1552970036992,"dist-tags":{"latest":"5.2.1"}}