{"name":"p-any","version":"2.0.0","description":"Wait for any promise to be fulfilled","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-any.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd-check"},"keywords":["promise","any","resolved","wait","collection","iterable","iterator","race","fulfilled","fastest","one","single","async","await","promises","bluebird"],"dependencies":{"p-cancelable":"^1.1.0","p-some":"^4.0.0","type-fest":"^0.1.0"},"devDependencies":{"ava":"^1.3.1","delay":"^4.1.0","tsd-check":"^0.3.0","xo":"^0.24.0"},"gitHead":"24a9cd4c4455c61ab6b14ba75a080e545886214b","bugs":{"url":"https://github.com/sindresorhus/p-any/issues"},"homepage":"https://github.com/sindresorhus/p-any#readme","_id":"p-any@2.0.0","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-5+Q7VpNIayPKaAYMeY3X/UIS05ycDCT8jZCnhylGkK8NGtnW0XH7ySK53Nh2AL0bVrveNDifarvRLp8T/5R02g==","shasum":"4a80c8a7ce59614190132c1f905df95d3bf7b58f","tarball":"http://registry-npm.ywwl.com/p-any/download/p-any-2.0.0.tgz","fileCount":5,"unpackedSize":5011,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcipeFCRA9TVsSAnZWagAAGXMQAJUXI4AlMbtQ0/ZW9CvL\n0yHpii4tJphXzquWZuJTz3fJzctqPBhwDqrQbXXePR1zSKbjoS+6r9CRghXr\nA8iJlTekLryJsaNgXIVutHrblBUsnTy8PjTnD1dy8Nl8atkN6We241x8IUp6\nKR0MZdDmsgne3bdcr8N7IJVyqASQkPnB2y3JBl897HIua2dLQyIDFcSr2963\ne0sSk/4y3zg/H/U3th7dGhAj9P3CPZ9+SC1rnaxkIHHV79JMCWeCEaj5rmUi\nPK2f4YCUSn1Oo2kstsFLslkPUNLNNZSskgPmlHKREnGtpKxMn6XGahBEp7Ej\nHMEBfB9qD0YNSScJsMeJDIbemCu0lu7q84UVLqHi9BIZjQYuyyJIIFK3f0J/\nkjIyZHNNrmG9B8o407jCBE2MIHF3Y0dW+8uuxkiHBPcSZr9LMgjxjquKTL6L\n5p0Cp0+iquBqbP6HJqSdVy6eZfBCTg4g3Opnx+yrw+WMir06lJGyZ/ey06K/\n/a8ifP8ZLolEFBhVDLLbsXXgi3fi5eIFtrNUw0aqcR4358/DnEr/uJjql/Ut\nfuOEFzJOi+52joZKhXUEPk/mcglBjdut0Rl04E7DfSfvO8Bmli5hf9Hdinuf\nIl3mhtAa67b3u6MixXXwt8bslG4huQtM2IpbZd9EwVAFzuZympLc1BBYgspX\nXgNw\r\n=EFFn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC/mDXTBSLbTM0n4ULnUVgTWSv2UOA4aBBZ656BAF2h5AIgeoXPKAS0tiEEtssz8YFCS99mGOtgoZxkOHjCiazo0Zc="}],"size":2346,"noattachment":false,"key":"/p-any/-/p-any-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-any_2.0.0_1552586629187_0.13780460970476294"},"_hasShrinkwrap":false,"readme":"# p-any\n\n> Wait for any promise to be fulfilled\n\nUseful when you need the fastest promise.\n\nYou probably want this instead of `Promise.race()`. [Reason.](http://bluebirdjs.com/docs/api/promise.race.html)\n\n*With [Node.js 15](https://medium.com/@nodejs/node-js-v15-0-0-is-here-deb00750f278), there's now a built-in [`Promise#any`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/any) method. The benefit of this package is that it has cancellation functionality.*\n\n## Install\n\n```\n$ npm install p-any\n```\n\n## Usage\n\nChecks 3 websites and logs the fastest.\n\n```js\nimport pAny from 'p-any';\nimport got from 'got';\n\nconst first = await pAny([\n\tgot.head('https://github.com').then(() => 'github'),\n\tgot.head('https://google.com').then(() => 'google'),\n\tgot.head('https://twitter.com').then(() => 'twitter'),\n]);\n\nconsole.log(first);\n//=> 'google'\n```\n\n## API\n\n### pAny(input, options?)\n\nReturns a [cancelable `Promise`](https://github.com/sindresorhus/p-cancelable) that is fulfilled when any promise from `input` is fulfilled. If all the `input` promises reject, it will reject with an [`AggregateError`](https://github.com/sindresorhus/aggregate-error) error.\n\n#### input\n\nType: `Iterable<Promise | unknown>`\n\n#### options\n\nType: `object`\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## Related\n\n- [p-some](https://github.com/sindresorhus/p-some) - Wait for a specified number of promises to be fulfilled\n- [p-locate](https://github.com/sindresorhus/p-locate) - Get the first fulfilled promise that satisfies the provided testing function\n- [More…](https://github.com/sindresorhus/promise-fun)\n","publish_time":1552586629315,"_cnpm_publish_time":1552586629315,"dist-tags":{"latest":"4.0.0"}}