{"name":"p-settle","version":"4.0.1","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"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"engines":{"node":">=10"},"scripts":{"test":"xo && ava && tsd"},"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.2","p-reflect":"^2.1.0"},"devDependencies":{"ava":"^1.4.1","delay":"^4.1.0","in-range":"^2.0.0","time-span":"^3.1.0","tsd":"^0.11.0","xo":"^0.27.2"},"gitHead":"d622e919a867ef202502f75b11f1b2ba3f27dda1","bugs":{"url":"https://github.com/sindresorhus/p-settle/issues"},"homepage":"https://github.com/sindresorhus/p-settle#readme","_id":"p-settle@4.0.1","_nodeVersion":"10.19.0","_npmVersion":"6.14.4","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-/9fOVH7ipE/TSaxHLZ95XklVLaX2rlOcocE17N/YARHaFbdKwf0jDnIVW22MVQ8sn3AjuJ0XIwylg6GZ3Lhg6Q==","shasum":"1179f77eb574c73f8e545a7d840fd167762af1fe","tarball":"http://registry-npm.ywwl.com/p-settle/download/p-settle-4.0.1.tgz","fileCount":5,"unpackedSize":6259,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJegFchCRA9TVsSAnZWagAA+A8P/1wMindvsotl5j8YD+ku\n3DXlhr1OD2SQ2PPBt1jYA8Vdg8eGRrLVNq2UPxDsHtvnUdEB2Je0+tzvojVw\n3ZgC59fbHFQqsBz1/fza92N2BQ6Jv4L1gW7lduobr5VxRYRkNkn8PTTn7Rgh\nLiq010X/2QyYQ9MzC+G0F2F4/1ejUYqPzvKcSeZ/nwG4e2b/MAXWTVgZybpe\ndigoGwZCypk2R7f/CU/LZqLDZC7MichY5xJhQI1hTC1E5IvzYPQdu2RzgQuu\nWHPVKQgI5p2x+p9V2nqsV8efu3fk5uwzASq0xpqWLD5J6uJjGbbvFa1YR++u\nDZBDr93C1zVsooXRcujc5otRnrBkcaAS/oqTOP+0niadEHwddls+r1Cb/gdH\nMJ9H2ioSyWRrQsSASbK+lwLCeldA/edzb5LXfEFRsImqQRtxhDFr+nhl1oH3\n4wQN4qy8cEYTwtkiYD+dCqOee0NDPHtVWMHibXPdFjl6R7DG+0m7xJZiGoVs\nSkDPgJrwt4l+j4rVmDXOJo9ZodTYLMKmAAWngvKCW/jZycyepiF5nHsgQ2Po\nwWzFhyjsENStfTqeyGWnUvHdzilvhL19b5VkOG+hzWzVDLb7aiqF8dPoJxlS\nL++hmWCAPl1R9h3m7kUtFeqZM5cNB2FR3Md21j/HxNqFRbqOT10KJMmCvPHt\n0xqo\r\n=g1kF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBaMVvQmesBBR/7UDDsz5FDGHGCevusyFxvdkTazFax7AiEAlrqoACxqpLw7AVJ//3Na48NMNzWQsMSIwsX/f5kL1KQ="}],"size":2668,"noattachment":false,"key":"/p-settle/-/p-settle-4.0.1.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-settle_4.0.1_1585469217291_0.8310048215713421"},"_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":1585469217446,"_cnpm_publish_time":1585469217446,"dist-tags":{"latest":"5.2.1"}}