{"_id":"race-timeout-anywhere","_rev":"385960","name":"race-timeout-anywhere","description":"A Promise.race timeout function which can be used with any module loader","dist-tags":{"latest":"2.0.0"},"maintainers":[{"name":"75lb","email":"75pound@gmail.com"}],"time":{"modified":"2021-08-04T03:21:30.000Z","created":"2018-09-26T20:40:31.669Z","2.0.0":"2021-06-06T23:18:58.362Z","1.0.1":"2019-11-15T20:44:06.294Z","1.0.0":"2019-09-10T13:29:38.579Z","0.1.1":"2018-11-07T23:54:03.822Z","0.1.0":"2018-09-26T20:40:31.669Z"},"users":{},"author":{"name":"Lloyd Brookes","email":"75pound@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/75lb/race-timeout-anywhere.git"},"versions":{"2.0.0":{"name":"race-timeout-anywhere","author":{"name":"Lloyd Brookes","email":"75pound@gmail.com"},"version":"2.0.0","description":"A Promise.race timeout function which can be used with any module loader","main":"./index.mjs","exports":{"import":"./index.mjs","require":"./dist/index.cjs"},"repository":{"type":"git","url":"git+https://github.com/75lb/race-timeout-anywhere.git"},"keywords":["promise","race","timeout","isomorphic","es6"],"license":"MIT","engines":{"node":">=14"},"scripts":{"test":"npm run dist && node test.js","dist":"rollup --exports auto -f cjs -o dist/index.cjs index.mjs"},"devDependencies":{"rollup":"^2.51.0","sleep-anywhere":"^1.1.3"},"gitHead":"faa034e39d0aa6651de2b5044e355e348d087a8f","bugs":{"url":"https://github.com/75lb/race-timeout-anywhere/issues"},"homepage":"https://github.com/75lb/race-timeout-anywhere#readme","_id":"race-timeout-anywhere@2.0.0","_nodeVersion":"16.3.0","_npmVersion":"7.15.1","dist":{"shasum":"679da307ba7c8b007f670db75def887a47cce57f","size":2133,"noattachment":false,"key":"/race-timeout-anywhere/-/race-timeout-anywhere-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/race-timeout-anywhere/download/race-timeout-anywhere-2.0.0.tgz"},"_npmUser":{"name":"75lb","email":"75pound@gmail.com"},"directories":{},"maintainers":[{"name":"75lb","email":"75pound@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/race-timeout-anywhere_2.0.0_1623021538220_0.7280713863712704"},"_hasShrinkwrap":false,"publish_time":1623021538362,"_cnpm_publish_time":1623021538362},"1.0.1":{"name":"race-timeout-anywhere","author":{"name":"Lloyd Brookes","email":"75pound@gmail.com"},"version":"1.0.1","description":"A Promise.race timeout function which can be used with any module loader","main":"dist/index.js","module":"index.mjs","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","dist":"rollup -f umd -n raceTimeout -o dist/index.js index.mjs"},"devDependencies":{"rollup":"^1.27.0","sleep-anywhere":"^1.1.3"},"gitHead":"a9e080e74016c800ad9d4cb29ee79eafdfa915f8","bugs":{"url":"https://github.com/75lb/race-timeout-anywhere/issues"},"homepage":"https://github.com/75lb/race-timeout-anywhere#readme","_id":"race-timeout-anywhere@1.0.1","_nodeVersion":"12.12.0","_npmVersion":"6.13.0","dist":{"shasum":"c06cb7f63dacbac6a42e1d1f24b58d10eaa8cb5b","size":2269,"noattachment":false,"key":"/race-timeout-anywhere/-/race-timeout-anywhere-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/race-timeout-anywhere/download/race-timeout-anywhere-1.0.1.tgz"},"maintainers":[{"name":"75lb","email":"75pound@gmail.com"}],"_npmUser":{"name":"75lb","email":"75pound@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/race-timeout-anywhere_1.0.1_1573850646189_0.05524526036911537"},"_hasShrinkwrap":false,"publish_time":1573850646294,"_cnpm_publish_time":1573850646294},"1.0.0":{"name":"race-timeout-anywhere","author":{"name":"Lloyd Brookes","email":"75pound@gmail.com"},"version":"1.0.0","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 -f umd -n raceTimeout -o dist/index.js index.mjs"},"devDependencies":{"rollup":"^1.21.2","sleep-anywhere":"^1.1.2"},"gitHead":"a0daa52e0c2c325c7452990f966c905f4f9116c0","bugs":{"url":"https://github.com/75lb/race-timeout-anywhere/issues"},"homepage":"https://github.com/75lb/race-timeout-anywhere#readme","_id":"race-timeout-anywhere@1.0.0","_nodeVersion":"12.10.0","_npmVersion":"6.11.3","dist":{"shasum":"91c14c1a0ec0911cf2df7e32660d935b4766d06a","size":2273,"noattachment":false,"key":"/race-timeout-anywhere/-/race-timeout-anywhere-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/race-timeout-anywhere/download/race-timeout-anywhere-1.0.0.tgz"},"maintainers":[{"name":"75lb","email":"75pound@gmail.com"}],"_npmUser":{"name":"75lb","email":"75pound@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/race-timeout-anywhere_1.0.0_1568122178480_0.595636310798733"},"_hasShrinkwrap":false,"publish_time":1568122178579,"_cnpm_publish_time":1568122178579},"0.1.1":{"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":{"shasum":"a484c850b2918566a2dcc82eff7d69c2f5f9a13c","size":1891,"noattachment":false,"key":"/race-timeout-anywhere/-/race-timeout-anywhere-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/race-timeout-anywhere/download/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,"publish_time":1541634843822,"_cnpm_publish_time":1541634843822},"0.1.0":{"name":"race-timeout-anywhere","author":{"name":"Lloyd Brookes","email":"75pound@gmail.com"},"version":"0.1.0","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.66.2","sleep-anywhere":"^0.1.0"},"gitHead":"31f02388a5ddb3c51afcbd12b61c45a2c1171034","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.0","_npmVersion":"6.4.1","_nodeVersion":"10.11.0","_npmUser":{"name":"75lb","email":"75pound@gmail.com"},"dist":{"shasum":"1842415dababf36a5948ef2cf9abbc8d6ff24448","size":2221,"noattachment":false,"key":"/race-timeout-anywhere/-/race-timeout-anywhere-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/race-timeout-anywhere/download/race-timeout-anywhere-0.1.0.tgz"},"maintainers":[{"name":"75lb","email":"75pound@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/race-timeout-anywhere_0.1.0_1537994431538_0.3472955749605655"},"_hasShrinkwrap":false,"publish_time":1537994431669,"_cnpm_publish_time":1537994431669}},"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","_attachments":{},"homepage":"https://github.com/75lb/race-timeout-anywhere#readme","bugs":{"url":"https://github.com/75lb/race-timeout-anywhere/issues"},"license":"MIT"}