{"name":"p-settle","version":"3.1.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"},"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.4.1","delay":"^4.1.0","mock-require":"^3.0.3","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"ed2986dc03293414adb1211d8f0fcb1e04c63fad","bugs":{"url":"https://github.com/sindresorhus/p-settle/issues"},"homepage":"https://github.com/sindresorhus/p-settle#readme","_id":"p-settle@3.1.0","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-gkN3UDlyofG81IRhxLnonSIi8BBrwcPlKMJS6tcJRubofyekqQPMdB5LXPrmCkeu/m/YKx5PzkUVQLezda5/JQ==","shasum":"6194f4f929364a8843be54ced118389b7b9ee017","tarball":"http://registry-npm.ywwl.com/p-settle/download/p-settle-3.1.0.tgz","fileCount":5,"unpackedSize":6021,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcpEITCRA9TVsSAnZWagAAluwP/1sdCiPfoM/yXFOz4Mkc\nlkbBbIEC7bR8G0z4HRRCEeC2/hMkzywNQ7K98jpTFlsNXoun1cTok+nRC3h0\n/xARuI9vhoneCqrWPW8MyvaiAN9PDMNHrb725Jrl3reZ2oxyMGXx5hXduMp8\nyMwxqVDQKf2JXecIuoS7M+RZ33EsUopLjxI36aiadJMxk+qYu5GrMh8LAAUV\nKGPLHLLVAoxjegC9d1I42Ao2vK3rtJvAd8BCJWQDjrjyOdHDLsBu32lOFCe3\n7yvnTyHPUTRJcFSfWIFTqvFsh3tUS5bVjXSn3r+9uXpbXm33XqS2S6T9ARqC\nTYPeyan+NMyuSlDoMA6XeR7RCtVzSIkpy8ytZDm1qO3kKMTjo62iNJuE3adx\ncAK8sCmK/G8IEhVYTe3IWmVRXkykoW7j4go4k9iiJzEpSZNbC+Ohr0mxOTMd\nvf3/w3+cDAeq2eGDTA2I/Es1U9K0yU4UQUpAfVcf68AwQkCu1CSp26jD5hmf\nS3T8YP5eZSSpjFYekdZPLtrDNlo128soIhZ8+Z+/plnlPKmOadgUpzYPy7aq\n9KDG1TGhqXgzQVZB1yz8UFxrMBmWZuUgxIfOv4Rhxs4aI8yBM3pGFBYU7Yjq\nKWyKBrZDWZgSD6f2djDhMUZa1XGZlh6+zCh5hs47u6QYP4Zhgv5j9MWYjy1F\nESVe\r\n=1arh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDSuMBpZl7s9Qx7MkOHlnDnznGYybTWhvOGhoCwuAYuKAiEAtwx6k6OJMRg4HLfA0IDHK3Cfo/CMcb/+bjiyDVtD8Oc="}],"size":2665,"noattachment":false,"key":"/p-settle/-/p-settle-3.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-settle_3.1.0_1554268690547_0.8972712823974991"},"_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":1554268690921,"_cnpm_publish_time":1554268690921,"dist-tags":{"latest":"5.2.1"}}