{"name":"p-settle","version":"5.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"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"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":"^4.0.0","p-reflect":"^3.1.0"},"devDependencies":{"ava":"^4.3.1","delay":"^5.0.0","in-range":"^3.0.0","time-span":"^5.0.0","tsd":"^0.21.0","xo":"^0.51.0"},"types":"./index.d.ts","gitHead":"a1c25286e62fd28b50abab878385c0010da11b3b","bugs":{"url":"https://github.com/sindresorhus/p-settle/issues"},"homepage":"https://github.com/sindresorhus/p-settle#readme","_id":"p-settle@5.1.0","_nodeVersion":"12.22.1","_npmVersion":"8.3.2","dist":{"integrity":"sha512-ujR6UFfh09ziOKyC5aaJak5ZclsjlLw57SYtFZg6yllMofyygnaibQRZ4jf6QPWqoOCGUXyb1cxUKELeAyKO7g==","shasum":"6abf85e073d6b137b48ed70f8a8d94660454bd17","tarball":"http://registry-npm.ywwl.com/p-settle/download/p-settle-5.1.0.tgz","fileCount":5,"unpackedSize":6882,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDEB8CRll2KekB4Ey1Hnq1Lzt1JpE+rJf96iUEKkgUNRAIhAKMz9+ZlMNSgTB1hGsb6w0aHBNfKVGK8pp8AVLmC6XNB"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi4bsiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmofWg/+LmQvEr735lyUjTbJ34YKwoLm+v8N2cL3h/Agb8IprN8dIYEx\r\n4yF6y1bZBx/BDmwjnEtzv4kfxdAgzkHxadtqdaJ5SpoXoZco8+3/hB+To/Ss\r\nYzRQ2rbrSfEPWNIX38C8/i6yo0tpQrF7qyTJt0cW50NE6Kw2CxmHXyjn9Tvv\r\nBbad+BmRxuuquDu2kd8BIyoN/G5yXn12JlQlaflYokcREI72pKPEVPXUKnYQ\r\nkOn/xpik5TGwz2sWXFPWRYW/ocHww0W4sG4VqQiCNLue+KMZa2hYOQfCg2d8\r\nS/stenI1SVAr3SLT/Iq1D8Zly7kst8Oy8R3tutfiM4f4LeW9+FpJGB21kMRS\r\nUGTVZwefzZRexgyr4qIKp/cdQUCyl5SYhz188/TEVzEwZZPZymYbm/7Q9Rp6\r\nMKULMlA+eO8n01ciJZLtbUZv8CkP9aKcS+4uRng9s7ioUYVJU4URgmqWK3gV\r\nV/KoITfGAAtCtQ2J2UFXdgo06jdfGfoJvQv5e8tfJO8e+hZBLtNEOIrl56Wi\r\nqst4ufhEcPB9z6caAAl1rAxm9kXJyqhWMm3SnSdY4w+QmuApny8g4n8V2+7f\r\nMN2YgV68jm7PJkCRavJs34ABveBc2nlCpZks/tBKAXsXb7x5B/44v5+WHM7z\r\nakEJfOYMkqcRsuVHbN07xfs+CNIj889zPyM=\r\n=VEkR\r\n-----END PGP SIGNATURE-----\r\n","size":2816,"noattachment":false,"key":"/p-settle/-/p-settle-5.1.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-settle_5.1.0_1658960674115_0.48122910042663736"},"_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":1658960674287,"_cnpm_publish_time":1658960674287,"dist-tags":{"latest":"5.2.1"}}