{"name":"p-some","version":"6.0.0","description":"Wait for a specified number of promises to be fulfilled","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-some.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"},"scripts":{"test":"xo && ava && tsd"},"keywords":["promise","some","resolved","wait","collection","iterable","iterator","race","fulfilled","fastest","async","await","promises","bluebird"],"dependencies":{"aggregate-error":"^4.0.0","p-cancelable":"^3.0.0"},"devDependencies":{"ava":"^3.15.0","delay":"^5.0.0","tsd":"^0.16.0","xo":"^0.40.1"},"gitHead":"a7030ea6ad9971867ba5dfdb09034a416f3cf8e3","bugs":{"url":"https://github.com/sindresorhus/p-some/issues"},"homepage":"https://github.com/sindresorhus/p-some#readme","_id":"p-some@6.0.0","_nodeVersion":"12.22.1","_npmVersion":"7.10.0","dist":{"integrity":"sha512-CJbQCKdfSX3fIh8/QKgS+9rjm7OBNUTmwWswAFQAhc8j1NR1dsEDETUEuVUtQHZpV+J03LqWBEwvu0g1Yn+TYg==","shasum":"4613a822038abe125e42152ea9f7705a7967526f","tarball":"http://registry-npm.ywwl.com/p-some/download/p-some-6.0.0.tgz","fileCount":5,"unpackedSize":7737,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgtO/gCRA9TVsSAnZWagAAFzMP/2J/JJF+OpxG7Uvp5Jmt\nH3FshHRseA/fFEo/8u5gBSZF+U2rhK+MkwhzJRwzP9fNvl6VT/kZk1mz31pW\n/zABUuoHzcWkE4uI2MMNlEUh8x8JFjvO/myZRAipGpfToBN6Om9e1eKB+VKt\nCuoQYHOV38Xr+cLAtuCQB9CZrbbDPNj8OQzVeJoSovCVGRexDiXN3gG6XtO3\nXH201HQyw/5HPQfNZJ7TFCM19kbjEWHTrc7Ky2+bg7vv8co9emAfzP7T4vh5\nTUVXZ34gPKrFtGPXWienezAGKCPBGkU3XjvKD6eUTIiBjBZ4oO5KP4BsTPv7\nki5NJu3bh9vIHSDAFmVqKtiR5VqBMVHiNB3XHU39qZWUDxsJfqOhO+DNmduV\n0bKwUeRpa6PwMYQGQLZRm8sfPzRkR1t4jr7p0VISzzSR4pgdvcwXnbaZxXTI\n5fPC/WrB2wATXu+eeNfPQcVvjsFGbZqw25SIY2h21KShbYjmKg34vTyNr6rl\n7fHfn3LMVvuFDzE9nVkaS/UBkosSm/qKm0eaFVzgoOjlPTBkvoNQH6BO/v2I\nbiyejBQbF21+lSEfUzV+/bLNTGYxBTC6k+rl7LUf0FL2Ct6ajw1oWRqTTvPY\nz7EPw8xKz81THtmMks/tpRwamW04EuEM9W+lB+vk2V92nn2h/EpdZPE+nbpZ\nGmL2\r\n=kQxo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA3wVRtpnuZjcj83PygmsLWxeLhd/l7YBHAPrGw/5ZOPAiEAtIh+s/r9aGdcZu14AYup2vo6FevbzcSS7OhacdUtr0E="}],"size":2991,"noattachment":false,"key":"/p-some/-/p-some-6.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-some_6.0.0_1622470624221_0.6974854217963782"},"_hasShrinkwrap":false,"readme":"# p-some\n\n> Wait for a specified number of promises to be fulfilled\n\nUseful when you need the fastest of multiple promises.\n\n## Install\n\n```\n$ npm install p-some\n```\n\n## Usage\n\nChecks 4 websites and logs the 2 fastest.\n\n```js\nimport got from 'got';\nimport pSome from 'p-some';\n\nconst input = [\n\tgot.head('github.com').then(() => 'github'),\n\tgot.head('google.com').then(() => 'google'),\n\tgot.head('twitter.com').then(() => 'twitter'),\n\tgot.head('medium.com').then(() => 'medium')\n];\n\nconst [first, second] = await pSome(input, {count: 2});\n\nconsole.log(first, second);\n//=> 'google twitter'\n```\n\n## API\n\n### pSome(input, options)\n\nReturns a [cancelable `Promise`](https://github.com/sindresorhus/p-cancelable) that is fulfilled when `count` promises from `input` are fulfilled. The fulfilled value is an `Array` of the values from the `input` promises in the order they were fulfilled. If it becomes impossible to satisfy `count`, for example, too many promises rejected, it will reject with an [`AggregateError`](https://github.com/sindresorhus/aggregate-error) error.\n\nIf you pass in cancelable promises, specifically promises with a `.cancel()` method, that method will be called for the promises that are still unfulfilled when the returned `Promise` is either fulfilled or rejected.\n\n#### input\n\nType: `Iterable<Promise | unknown>`\n\nAn `Iterable` collection of promises/values to wait for.\n\n#### options\n\nType: `object`\n\n##### count\n\n*Required*\\\nType: `number`\\\nMinimum: `1`\n\nNumber of promises from `input` that have to be fulfilled until the returned promise is fulfilled.\n\n##### filter\n\nType: `Function`\n\nReceives the value resolved by the promise. Used to filter out values that doesn't satisfy a condition.\n\n### AggregateError\n\nExposed for instance checking.\n\n### FilterError\n\nExposed for instance checking.\n\n## Related\n\n- [p-any](https://github.com/sindresorhus/p-any) - Wait for any promise to be fulfilled\n- [p-one](https://github.com/kevva/p-one) - Return `true` if any promise passes a testing function, similar to `Array#some`\n- [More…](https://github.com/sindresorhus/promise-fun)\n","publish_time":1622470624325,"_cnpm_publish_time":1622470624325,"dist-tags":{"latest":"8.0.0"}}