{"name":"p-some","version":"3.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"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=6"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["promise","some","resolved","wait","collection","iterable","iterator","race","fulfilled","fastest","async","await","promises","bluebird"],"dependencies":{"aggregate-error":"^1.0.0","p-cancelable":"^0.4.1"},"devDependencies":{"ava":"*","delay":"^3.0.0","xo":"*"},"gitHead":"4c21d2456154e86fc8e26474c787fe2d63b72c8e","bugs":{"url":"https://github.com/sindresorhus/p-some/issues"},"homepage":"https://github.com/sindresorhus/p-some#readme","_id":"p-some@3.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.2","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-pmJQEeetQBjA3DiE4Gdbc8WEAwlpv72eP0XP0XLX3nNcY6MBRemOxvbuYaiapQ6dIHKCGMZNL80ci2bYCtWIXw==","shasum":"e099513d89070301a4c0fc22810fa6abf6b218dd","tarball":"http://registry-npm.ywwl.com/p-some/download/p-some-3.0.0.tgz","fileCount":4,"unpackedSize":5625,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbCRsZCRA9TVsSAnZWagAAmBYP/ioJi7NWkPqwgm8L2gVq\n7SACU5IYpLdsQxTpLaXrcqqI3Q+g9JZhAOn19Iv+OXo1E1DRKHpK0XpHt9MU\njgSbmUDbP+mbJoKka68XbaE/zIxVO+rlen7s3T0lzKN+qeWPj4+m907nw60M\nXlo8HlA41ze5hPfqWGZz3M9snsmPafIgT3acRZ87dZ0CR+bz8YX2Lr3VcPMK\nkXPbS/QkRmZ3lyfDjp081LMWO6KsuEQdGnVXJDvSCSkovTmDdsqBb138OtcQ\nN8J2vLJLfCQ7LBmKQsJ/iGeERzj32pjkaNN4vf5j4Hus3kW8GOtW1E4BuoIw\nQQhmO6o2hB/XIgIj1usgTrh2AfbJvmpux/aCRkbAAj8uz/cAi82aoTUnMuKN\nFU3cVxFvAdKwyVW2cWkaq9PNX5WQ4H1JyK2qUJWHagbFNnXg7N0kf201J94j\nz7NSaE29BtYDwUpLJzJvj7Oy0aFgif08XYfvdTwJ2lGZLBI7hbmLonNmLYdH\nNVk+to+emshxBcmhvVtOwk3BJJ/QbwDjvO3ujxnI7IYGqvVrELDbw6kbnD5U\nn3HbEVnXIHpmyLOaVzNTgwQFTFYfxN49Iz/+658UNXpWsBbeV2exb3SraWB1\namjoZOFa2KSBOY9wp9ON4x0d4vbQjoYUHs5gECiFxm138RzBx58qRwV+/ytG\nNNf7\r\n=yfPQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDyYm7exOBul/gBEahVDVwhZKvwfin6rY4LPHcA72hFxAIgdZ+8xrFn9NMMtyJNiiae6RGNgEBjgfp/N1u2OZjn2Rc="}],"size":2644,"noattachment":false,"key":"/p-some/-/p-some-3.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-some_3.0.0_1527323416467_0.5373062719536816"},"_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":1527323416546,"_cnpm_publish_time":1527323416546,"dist-tags":{"latest":"8.0.0"}}