{"name":"p-settle","version":"4.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"},"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":"5cafdb79101eeca944dc4b07a5f8cc95e4ab1ce8","bugs":{"url":"https://github.com/sindresorhus/p-settle/issues"},"homepage":"https://github.com/sindresorhus/p-settle#readme","_id":"p-settle@4.0.0","_nodeVersion":"10.18.1","_npmVersion":"6.14.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-MK1FEHO70HHo4uCjM2DP/2gOpLGjEes8czFH7bP9RzJS6mAEp7dFINcUUuuQXa+ZFztzKTdF3zl0IiBH1BCkrQ==","shasum":"07fb60aded04527eadd617c9fd6801364c4737b8","tarball":"http://registry-npm.ywwl.com/p-settle/download/p-settle-4.0.0.tgz","fileCount":5,"unpackedSize":6248,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeYOnUCRA9TVsSAnZWagAAE6cQAIyPDmzt2qufRImmV7/u\ndxZHMO1aMUuu3rsgyk1h81ny/QAXPjTQxtS26IlJthPEwpzjuOcu1gr5+Fn+\nbQYY9i9ccPoAruS0DNLDfZrGN7mL3kHfrpdhV+S9pTkcsPA5GcyIMtiyhkwc\npOwU1Hx7UB5EuRw+JF1obtKdL6r3mfC1f28oRpY+zH257Nd77SA8ArTz9Jw/\nsAXz3zfHFMM4LLTMnASYK4A/JAWhGxL9mmb0/VUrlV6mKThqoYL+3VTeNZNY\nTiI6RLBqcLcOmL87SDVrSkvmZFiqj5NrvCf5QiujoYrTV+6pklD+Vp4w4kJK\nVcA6gF1SQ9sA7aHMh7I3V1i4XwC004iTiwe1JhNcQDLY0s+4dNLVQ2YLDzF7\nfIlRHB8ozDsrW98belvYp2PC9PsJc2czbA6dP4SOY+EEJHsAb6W1jeQzWnqk\nqDbI44oZUuBPsoETRWLrvDGmKUJ3S80Q+WCUqWcSS8yAzhTR2mp0sSNP7Wo/\nwVR6L+x0Vyd6eRDEAZ5/bNzjG9vDKbEj9jCeuSUqrDQ7QBygPzVj2+gSql/G\ncCQ+gYf/pWRvZfYBDnlCINUM3QvSph9G39QxXTP602PUstQ6ECOMR8sXkWZw\nNTkD5Qw8OHW3wLqE2HHL0//GwzxA81/jRXo+Mv+1s1Ne0j6c4CPfba8/Cq3p\n6plT\r\n=HVtm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICORyk6/6begiD0IEIFbBZ5+gf3X5SggaFuFDXauOxbGAiEAnblIC8d8jhAXIw+Qm3v8T693Rm4v+oSURpkLhlt1fYg="}],"size":2666,"noattachment":false,"key":"/p-settle/-/p-settle-4.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-settle_4.0.0_1583409620485_0.9703273947642765"},"_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":1583409620599,"_cnpm_publish_time":1583409620599,"dist-tags":{"latest":"5.2.1"}}