{"name":"p-settle","version":"5.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"},"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.0.0"},"devDependencies":{"ava":"^3.15.0","delay":"^5.0.0","in-range":"^3.0.0","time-span":"^5.0.0","tsd":"^0.17.0","xo":"^0.44.0"},"gitHead":"ad15fa3ef0f0e892ac78f7f3c08af10d5230d336","bugs":{"url":"https://github.com/sindresorhus/p-settle/issues"},"homepage":"https://github.com/sindresorhus/p-settle#readme","_id":"p-settle@5.0.0","_nodeVersion":"12.22.1","_npmVersion":"7.10.0","dist":{"integrity":"sha512-P+cL1wECSDqI49JAiHlgG0HlqqL0CBsMP3f8vrVx6Yy8pMngmJqn8UjzAHr5CPkcDIzeBxugDLDMWTK8fqrFGw==","shasum":"b7008de2f225ed9132317d995ead4c007684024e","tarball":"http://registry-npm.ywwl.com/p-settle/download/p-settle-5.0.0.tgz","fileCount":5,"unpackedSize":6171,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhFbYvCRA9TVsSAnZWagAATwIP/j0ZpwV/QrYz9lROWXpi\nv2ff4zBb8f7LwVQrUdWErqXKvbO6uEPTugRAS8T5VBjNZ7QXpit3aJMhRDmP\nCe9V2cjkxK4rLSCoA5lV9wpK27NYtcsEFKj7qiNxqooAq+sbtSyZj9Re+hiw\ntMrYSJYflal2PdjBYp43p4Ty5ZnsWpHBWYsAv7LEYALImCNQGlDhIZ4TPAc7\nVIZtBG29EtgK3rXsfna5jvAJOyxlPKGuKr/lK9cJ/FZwY92uXEQLxwjiGWpv\n5pCg0SngIWfyPgPw4vWFOYs+KoytpRh+8V+Gi2cQ886ObomDw7t7OuOPan8d\nXaL0UD8E1ZoMQMVov2sfXj3JF6ZsRYmCnfgei3Cyr7JW0Wo4ZvI9PbTIyZz7\n0gAn5LfInLDBJfFsU3g/M47NeJgqvrcvTAordH+xxhVDlgD9MKDjXCr1hn9C\nbVQy8aXaM91WIE82xbmLoOiph/BkxoJkHM3YdGi5BWuRHHhfZ2vXNPR9uhA7\njFpMxgaTxqkj3J/CoX09pBJlaXSmBSfzytwhA3SRT8M+ReoYkDhiO/0hLBiJ\n/NRWzF2bRprWU6orBXPkZpnBVhXwrEOAaQ7+AQdTx4QzsZIKMkSYj+v0B+cK\nB16vg5gW+FJF6xSkwfye0Btfo0eC81vqK3jaGysUOBoz3q+RO+EqoY1KFZg5\np5TP\r\n=aumV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCkWdMKsAX1gmebuFVEbEQ37HAP+/H9CY1u0EwghEWzvgIhANSB2yERnnx1d8DNq7Yq10Mj5PvZhHYt0z6/19L98qMj"}],"size":2695,"noattachment":false,"key":"/p-settle/-/p-settle-5.0.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.0.0_1628812847842_0.027357978616565415"},"_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":1628812847991,"_cnpm_publish_time":1628812847991,"dist-tags":{"latest":"5.2.1"}}