{"name":"p-some","version":"5.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"},"engines":{"node":">=10"},"scripts":{"test":"xo && ava && tsd"},"keywords":["promise","some","resolved","wait","collection","iterable","iterator","race","fulfilled","fastest","async","await","promises","bluebird"],"dependencies":{"aggregate-error":"^3.0.0","p-cancelable":"^2.0.0"},"devDependencies":{"ava":"^1.4.1","delay":"^4.1.0","tsd":"^0.11.0","xo":"^0.26.1"},"gitHead":"66981d4f0531f347a9ae6d2a87b657444846cad3","bugs":{"url":"https://github.com/sindresorhus/p-some/issues"},"homepage":"https://github.com/sindresorhus/p-some#readme","_id":"p-some@5.0.0","_nodeVersion":"10.18.1","_npmVersion":"6.13.7","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-Js5XZxo6vHjB9NOYAzWDYAIyyiPvva0DWESAIWIK7uhSpGsyg5FwUPxipU/SOQx5x9EqhOh545d1jo6cVkitig==","shasum":"8b730c74b4fe5169d7264a240ad010b6ebc686a4","tarball":"http://registry-npm.ywwl.com/p-some/download/p-some-5.0.0.tgz","fileCount":5,"unpackedSize":8061,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeTSysCRA9TVsSAnZWagAAiFcP/RIg77M5fuMgQEC5gApM\n2xCuoYcOrZGvAVzflsBwOkUavAeIa3NQTSHX5juLzedNABbyLiBjPBkyXiNf\nH/fg2cnc0Cmiz0smjqRB5/Rts1RL/XrS+B2N+6hrUreyJieTbnprEFtrmiYU\nH/ZDZY0BQQyADZVdZPq7+1ou8bORkDJDdTN6CMh2RouV4OBMdnS19v4eNbDS\nj+5/fFVjqLhiVlv6sih+C7oN4DF5P1Y8czbBPaNwsXT+OAogkMQA4rJcvk9R\nxFoVwQf/9Aaf1c13JmpV1/ql0rAqngIsb8IiPvf1H9Fu6gS1fxyb4v/9OlFz\n6Rm0Rgt4fy7SbkIZRASvnBjBzOkovhYwP6JBYGOetCJJrF1nUDapGk5Xr3Jd\nJwYDfol52ifaPiDaJ26xO9CZEhXQXq8yZW8rgrLbU+/u6Mly32BkEvKRcMVy\n6yFxRkG+Qluvuh83KdgBUOI3s1Q5ZDKGPwyPMlra7Nllhj7thbqGxWTDNCLq\nNwY21lExXKou1HQPSQnuc0FcBsEBMqHFirQ16WfoO2FYXyBq5o9ZlfAwjb1M\nRt5e8X1VEGP4U7xw6J4svZKOePDe2jQfe28TaTpW1PssKRVLv+aPlivyBn68\nrEeLr2CbPMqrOFAa2DFC7EVtr9VJHjIGQt10BED6m/TEKZOBI4qnfbmzLxSG\n9084\r\n=4KI7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF6obiQx4baEU5NAB+odzDV/Kmp6JiU+tIoC7A2OaB1AAiEA0IQl5+IP8HMwvmsBXLLFNHsNneUUb06MJeIhhFK2apw="}],"size":3121,"noattachment":false,"key":"/p-some/-/p-some-5.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-some_5.0.0_1582116011517_0.27586732933001157"},"_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":1582116011636,"_cnpm_publish_time":1582116011636,"dist-tags":{"latest":"8.0.0"}}