{"name":"race-timeout-anywhere","author":{"name":"Lloyd Brookes","email":"75pound@gmail.com"},"version":"0.1.1","description":"A Promise.race timeout function which can be used with any module loader","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/75lb/race-timeout-anywhere.git"},"keywords":["promise","race","timeout","isomorphic","es6"],"license":"MIT","engines":{"node":">=8"},"scripts":{"test":"npm run dist && node test.js && node --experimental-modules test.mjs","dist":"rollup -c dist/index.config.js"},"devDependencies":{"rollup":"^0.67.0","sleep-anywhere":"^1.0.0"},"gitHead":"2ffee14a4c64252c64409399389026a7f892eb1c","bugs":{"url":"https://github.com/75lb/race-timeout-anywhere/issues"},"homepage":"https://github.com/75lb/race-timeout-anywhere#readme","_id":"race-timeout-anywhere@0.1.1","_npmVersion":"6.4.1","_nodeVersion":"11.0.0","_npmUser":{"name":"75lb","email":"75pound@gmail.com"},"dist":{"integrity":"sha512-H1wGOu9cvOnG9q4asm34wisqjrat67zFqyDAiCto3TpCBgkiyIJKA3TUPibephfGO96J1V/Fq2iTHLvcX/v8bg==","shasum":"a484c850b2918566a2dcc82eff7d69c2f5f9a13c","tarball":"http://registry-npm.ywwl.com/race-timeout-anywhere/download/race-timeout-anywhere-0.1.1.tgz","fileCount":5,"unpackedSize":3701,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb43scCRA9TVsSAnZWagAAo4gP/RAV/vHvdZfhJPW9rrtc\ntRd6bqe7j6nEihS2lIbViMIjyt8KmnrnsY0eR47NbVITXXmiUspviDZGr6CQ\nNVIaPxh5/yEQzOVs4NqxapAkxrVADRRPUwCk1amGfghyVmJl2tnnu2r3AXuR\nt1IyKGdohuCx3gx0vrgqDrCQxBq18BONlXYaQ12paTgSqCtmpv91dryu/IrN\nB4LI9XDdU/dY15k/LAXpCeCaAJKUc5I0yTGbFWAnRqkBOW4rW9xei4YjQ/Cn\nNsGg13hSRLtB7/NbEt2xpQrIXq3eUIKMCUF4JHNd0ULtVMeauJCGwqSW6DCp\nIn75uvbAc/fy62wXMwk0mJg8LC5ZXkQGVyXlERog0bdJTBuQsU7/F4dwlD0d\n8UWiZ2oMYBh8cHH0UgFu0BeFmHwu9O/+EjtMn2K5VAPYx6Ec+pqRcCbD7ttq\nHazNfUhx2owOsgPTpnI7YjebMZDuE+YauZN44mwAmP+iKV5/Boq1jpC8qVKK\nNtGbf/n74SXCong+YuUjsfPvSYo09PYCZw0d7r1/RFOoVOC1xZ810AkwB6rL\nyNa1g5Ur5Bw3AOr8QylgtetK1QGs2aMjBSQvo7Gv4D2b81aQQHiWbIOoR7G6\nLY60zoDZQzqW1vvADaLioK61OuoJV9yzBOgYBy9TjE5WVU2ZbS1ma/fo95wI\nvJEv\r\n=oyKO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFjjoAMDRNcGHDaeEaRVsfgo34GcBn08Ma4IEl2ANExVAiAcvGZB0wXZWJ7uHVWda955xy50GVMp25hTVrO3GShqKA=="}],"size":1891,"noattachment":false,"key":"/race-timeout-anywhere/-/race-timeout-anywhere-0.1.1.tgz"},"maintainers":[{"name":"75lb","email":"75pound@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/race-timeout-anywhere_0.1.1_1541634843714_0.7105967174790895"},"_hasShrinkwrap":false,"readme":"[![view on npm](https://badgen.net/npm/v/race-timeout-anywhere)](https://www.npmjs.org/package/race-timeout-anywhere)\n[![npm module downloads](https://badgen.net/npm/dt/race-timeout-anywhere)](https://www.npmjs.org/package/race-timeout-anywhere)\n[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/race-timeout-anywhere)](https://github.com/75lb/race-timeout-anywhere/network/dependents?dependent_type=REPOSITORY)\n[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/race-timeout-anywhere)](https://github.com/75lb/race-timeout-anywhere/network/dependents?dependent_type=PACKAGE)\n[![Build Status](https://travis-ci.org/75lb/race-timeout-anywhere.svg?branch=master)](https://travis-ci.org/75lb/race-timeout-anywhere)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)\n\n# race-timeout-anywhere\n\nAn isomorphic, load-anywhere timeout function for use with `Promise.race`.\n\nThe `raceTimeout` function never resolves, it will only reject once the specified time period has elapsed. In the example below, `fetchDataSomehow()` must resolve before `raceTimeout` rejects after 1000ms, else a timeout exception is thrown.\n\n```js\nimport raceTimeout from 'race-timeout-anywhere'\n\ntry {\n  const data = await Promise.race([\n    fetchDataSomehow(),\n    raceTimeout(1000)\n  ])\n  /* fetchDataSomehow() took less than 1000ms, process data */\n} catch (err) {\n  /* fetchDataSomehow() took longer than 1000ms */\n}\n```\n\n\n### Load anywhere\n\nThis library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.\n\nCommonJS:\n\n```js\nconst raceTimeout = require('race-timeout-anywhere')\n```\n\nECMAScript Module:\n\n```js\nimport raceTimeout from 'rice-timeout-anywhere'\n```\n\nWithin a modern browser ECMAScript Module:\n\n```js\nimport raceTimeout from './node_modules/rice-timeout-anywhere/index.mjs'\n```\n\n* * *\n\n&copy; 2018-21 Lloyd Brookes \\<75pound@gmail.com\\>.\n","publish_time":1541634843822,"_cnpm_publish_time":1541634843822,"dist-tags":{"latest":"2.0.0"}}