{"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":{"integrity":"sha512-FwYyoKxgK/NNC7Tn2LlFpfNHemLlYOTCruUyYyEzQfkaO4iCQlGipsqOPhJvT7oGinMz707/HAnSFj98b7T4dw==","shasum":"91c14c1a0ec0911cf2df7e32660d935b4766d06a","tarball":"http://registry-npm.ywwl.com/race-timeout-anywhere/download/race-timeout-anywhere-1.0.0.tgz","fileCount":5,"unpackedSize":4676,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdd6VDCRA9TVsSAnZWagAAT4QP/idZCb0HaDrBUtuR4JtH\nnxIwN/yuOcPGNjczmWIGyM829cF5Tq7OWnSL09ZeIGosFIxYswgjxXBP4Bms\nZsss0GCFK4+IRRe2hvDVwP+qDikK02X9KLuqYBvypIC3CagLZRjBiaewVEQV\ngBRkCk+aa5Xv1B05cXkbS0lKG+cugFzVxzgeHCBqS21Gilh9h25Syf2ieyik\n3wTEGtctXINcOFaccX3kMQfRQg6F1+7KbE+6buD3rIPhv/KFHlxmvOlPKsbt\nTLyGQXa4WwXDYu4eYOKoxr74hDajDXOHtKtB49B1NW7RrBqZFJSUF4mcxyMQ\nk7gE2l968r2UF9kl6E6Hj1oOv8JRgJElYVqi/RaRTE2uTqS0zdnMtZWbvcuY\nzVKrraxzdg4Jmh+lR3LxKFr1i9lKjDzkLWYrY6lv1qLChiTA/WDh4ilQAICa\nEPTCGayejx9rqkWjBH/r3oRy55jOS6RiCV0TW6Tjfgu+9fj9x9/mGvb/2psv\nHtFBAajoQdf57KxXuvJgAkDKUED4sdQg670+968Qctmzee7SkEfS5vkT8PU2\nSxCoYxP1A9hlsuGLqkwXvoMyf53boDnZaxlsfmSTd90F+GrctJ6RCMc9cUU4\nwMnv29j2t5zxQCdn6ytmTXhH7VHCIboyvMeweNkySqWCTujUHoxKY62OegBK\n49m7\r\n=5N4u\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDsZSzpHCbQdmpxD3nnKkDwj3jI6oz6oJEb4eR4/9aIpAiAtD44B0lV+TTO8j3O4Q4jNaCk7g9uwdLHFZwxNIrIOEw=="}],"size":2273,"noattachment":false,"key":"/race-timeout-anywhere/-/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,"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":1568122178579,"_cnpm_publish_time":1568122178579,"dist-tags":{"latest":"2.0.0"}}