{"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":{"integrity":"sha512-b6fA5IQTjzf6X8QgmTg5F1xJlnMLYc8EQKrwrZQN5dfOBxcXsWzurdNHcEmFtOT23iiCzi+XA4ZFazdaZEoVCQ==","shasum":"c06cb7f63dacbac6a42e1d1f24b58d10eaa8cb5b","tarball":"http://registry-npm.ywwl.com/race-timeout-anywhere/download/race-timeout-anywhere-1.0.1.tgz","fileCount":5,"unpackedSize":4663,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdzw4WCRA9TVsSAnZWagAAuy4P/iEFY8QZ7aTyfEOArkCg\nkHlB9XAQhHWA6rjKxUed+t/CpiUgnL8U78zgO11M7dG72LjA9spjkky+6jUP\n6cYvtD8Fo/RAdeExcez7571XxtMXbySPYHjdEi81rc3qq/5zEMDNudT7nnPL\nfJA2lWp9PQkkNR64ICsvJmVYIs4Fd/PON7P77TsQtG9Bifq8d57eo0A5li85\nDT7G3PPOIdSmwqTzPmK74P3x+1YzmD71LA88zO3qkR0Ha+xBPwHmAOKtZK9P\nTRUU//oMrjftfqb7HH+HI9yJ86cAIc7iaC/AFl6QEthEzqeeev4OKHhz7rPi\nkaUBRDm2OK24K0whpy8V8Lb73UL3E30Jce6gZr2RGYQU3Smn1qhHWNv3VsCV\n8/iSGle5ZD6UP8jjbBOHFde9ifjCSw21tY/h/I8/Hhyk6OpQnq+31K3if91g\nS9RleuH1/f6MNgpthCRa7IixhnSTDsXQgx1Xvee8wNaKmM3iSyDj5352Oqow\nfZMI8UhdnWMMt6MfiYuMTL8HL7EZUk/b+S1qjJss4SORZMlQwbqj/i3B6N3K\nG8H5z/Vaf2JnWTg1Yj7tKpdXZIlTvRxzTVbmyOcZKHRzM1Lyr1SVG/IF9HlU\np2hWqDH2GMJnlCKxWh4zMQ/QllFfazU+JSM1f6NIckapGF2goCX8/l1XvmrC\nUwQl\r\n=MDZ9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICA/847XeK6GiElIPDZPPPMxKn/hi6pZrQNUiqAjr+e8AiBwyywnL6dyOqiirZpVpQ/kg44f+9Ky7XjXE1ZL5WmQxQ=="}],"size":2269,"noattachment":false,"key":"/race-timeout-anywhere/-/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,"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":1573850646294,"_cnpm_publish_time":1573850646294,"dist-tags":{"latest":"2.0.0"}}