{"name":"p-settle","version":"4.1.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.30.0"},"gitHead":"071020fc6cd7884e74228d546943f53cbc3ca28c","bugs":{"url":"https://github.com/sindresorhus/p-settle/issues"},"homepage":"https://github.com/sindresorhus/p-settle#readme","_id":"p-settle@4.1.1","_nodeVersion":"10.20.1","_npmVersion":"6.14.5","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-6THGh13mt3gypcNMm0ADqVNCcYa3BK6DWsuJWFCuEKP1rpY+OKGp7gaZwVmLspmic01+fsg/fN57MfvDzZ/PuQ==","shasum":"37fbceb2b02c9efc28658fc8d36949922266035f","tarball":"http://registry-npm.ywwl.com/p-settle/download/p-settle-4.1.1.tgz","fileCount":5,"unpackedSize":6506,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe0MLHCRA9TVsSAnZWagAA2XMQAItuUioIr1BAzYYQq1Op\n0vjhyNICyP1GCK3RmuM/A3Ik0AjAAkhwXk72IUseinim8Xp9DxMZoK34J4Xa\nLGIm1yXkQDRNjPHcvlJKiguWiinCOFk5abuU4eyC86IkRSoDGNkfx9BshdBt\nnho5cfKQqqqeTYDmvpYemPFSm6OfV7jlb2AEyFhS6HdUpkkOVRQn9+SlVDPT\nZuyQE6exopyD1vKeKZwYbB/VZDO04w8u+/M7zbKgqF1D3XAJZuMjiHcRleoC\nClE2nEF+DMPwzRmRBQgPcnB5LnZaUQBAtalgk8ZRsbyQlJygtddShXIETVO/\nt7WGCX19KyOZaCO7knzGzpveji4JN8kEZ5gNcD1Aomy24Cc4sGDmaUzZ5b18\n2lo/HGK2MSHBySSzlo6WR7mNiORbLBQJTSAwoy3v/Jtk5lubmqzQ8EJu+0nR\n5aRa8R7eZQi2QLe5g1OmrMCQHjLU7zDhPbJQTE2RYOa2VCL6YqPFDxOTl0bK\naltwxSISuNagGG+aln33Z4AgmhQiPxUJcbu6MB53SA21shBvfjZ1++8MFggU\nWku6TeIArIG6TKMtU3Fj39mSP4hvHkPmAeCKWDSMIW0pBonv9qmLIGnEaiL0\nSzaXDFASwQEcHxqmnuLr2bp1OBmsvJwFzh7xRabjI6K/5OyvXNUQ8uwE5clL\nf8+h\r\n=ZW/j\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHLDiTKwePYN6Fp1vvPrdXEZ9voofVA31ymfsDcHe0DWAiB42oN/RrY22jQULeXiyryjuWlZeyLjH4IcHajKf7R46A=="}],"size":2812,"noattachment":false,"key":"/p-settle/-/p-settle-4.1.1.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-settle_4.1.1_1590739655013_0.40914446897727585"},"_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":1590739655109,"_cnpm_publish_time":1590739655109,"dist-tags":{"latest":"5.2.1"}}