{"name":"p-any","version":"3.0.0","description":"Wait for any promise to be fulfilled","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-any.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","any","resolved","wait","collection","iterable","iterator","race","fulfilled","fastest","one","single","async","await","promises","bluebird"],"dependencies":{"p-cancelable":"^2.0.0","p-some":"^5.0.0"},"devDependencies":{"ava":"^1.4.1","delay":"^4.1.0","tsd":"^0.11.0","xo":"^0.26.1"},"gitHead":"f8fdada8495f4a046064b5d49bbb3488be6e61bd","bugs":{"url":"https://github.com/sindresorhus/p-any/issues"},"homepage":"https://github.com/sindresorhus/p-any#readme","_id":"p-any@3.0.0","_nodeVersion":"10.18.1","_npmVersion":"6.13.4","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-5rqbqfsRWNb0sukt0awwgJMlaep+8jV45S15SKKB34z4UuzjcofIfnriCBhWjZP2jbVtjt9yRl7buB6RlKsu9w==","shasum":"79847aeed70b5d3a10ea625296c0c3d2e90a87b9","tarball":"http://registry-npm.ywwl.com/p-any/download/p-any-3.0.0.tgz","fileCount":5,"unpackedSize":5383,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUT42CRA9TVsSAnZWagAADXUP/jYX61wphRim7uuBE5b7\nJibXNonUmRqn/b8cePaij8+SRNX54mv1C+bqHfR3ZU2paImPSQ8h4KKlRoj9\nBswyHM4+bTtt3LtYFuUbn4WxyU9xdJFBQLmu4m88vUuO9Qsx00SpGk4YUpTb\ne5TQW3N4MbyZNQs3LTJqVMhpTkGUzMHmjamhj4+TXCg+BxkLwJMrTk/Sb8xv\nhE4pqoLCQZog3Vae9fx8Kc0Lh2sf9SuJqQp+MfI1ioGBXmsDF7AXi4QVFc1h\n+22xjWJxRt47yZGKH3D9yY4YwcJtegjbp3LooaEdH/3FfFXEG13nKr01tB8P\nV+xtt26T+2DaYdWsxz+3f84OGDRWoOALVc7lvLemlHdZjmqntWM8MKcpHARH\npIyrEgeB2S44RBPDa6FMS/AHIkIhE6G0ZY8LlnfDpyNoJwRamypJcjxtMttu\n7fKwMaPnhKz+nvtkFnDlsX0mlxBUr00/ds0Oswe9WttTSMcQ9nyeMQk3ugCe\nQkiE2P3Hjmw0xAq2RCMykS6Da1zoh61nOjevDiaidDrKhurOXDfmYYhj9KRm\noUhm1WL45T/BTDmzdPD72abg0cDasGZ52aCDx7u2X9GCK6NtgGlk2R1bOG0J\npVv/eRiDsp5w16h//8oPRcPTx8ib++uLxVuLM7oNKFK6LeZxaJ5dtSNkfzIc\nL9qS\r\n=sFsJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDRZWV8jCrtc0f0BHHARGn0ZkX0mWTVAXymAFcP56eWOQIhAL66R4vRtVqybmXjjI3ZWFoeRpVLspSblg5MWRqNN6Ab"}],"size":2403,"noattachment":false,"key":"/p-any/-/p-any-3.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-any_3.0.0_1582382645910_0.12211509883760985"},"_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":1582382646005,"_cnpm_publish_time":1582382646005,"dist-tags":{"latest":"4.0.0"}}