{"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":{"integrity":"sha512-kFE+ZL9Esq2JVcHp+ygSI8bTSAfJuXi8nQCDVAD2zLYJ/TMzObyLLbVaXA99JFVtsibIF7A1IqJRfiC4H+muxQ==","shasum":"679da307ba7c8b007f670db75def887a47cce57f","tarball":"http://registry-npm.ywwl.com/race-timeout-anywhere/download/race-timeout-anywhere-2.0.0.tgz","fileCount":5,"unpackedSize":4490,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgvVfiCRA9TVsSAnZWagAAoF4QAJXH9dkYeBiSh5tvDlWO\natg4qiBmDu9y47iUamL5G9aeSCgWEtWq4whwdVqCrxMjFXWd467K7dEl2Nc9\nQNfsLGq/84s7rRPCRGs1FkTIyjNzbUG7Z+E2VwV+Iy7Mu1Ouhx3xeOc6TFa/\nEY6JfJX3unpG62NIdiy/J7ngatcalbTxKfo/hahhp76PxRz3t5qkm05gKHJs\nTtuMCH+gWubIrJk53xD0wLmxCmS3yv/YlMwfRSFCf1q/fx+NnHY+cR7bdAAR\nupgirD0s9oHZ+Glbz4ARzu8PX1hhUdflmVTyxWOoaX/IeLuJ3CM4+vX5fBqI\nDbyOoDfKL5rPfsi2Xoc7OjvIvX+tOjnQ9D54L7YElk57BYu9SlBR0Rg39UwP\n94tgp8Tbndq03AF5ll7UdqNjgG9t1XkXlV8NEBAkme9B3xyGMS0vv9CQ+guL\noU2z/HdmfHLDARuAatNsC8REZZfT3k0zJAtirr6smHFfzqRsoIHl1I6eeqCx\n3KSK0BrtRUJ+yRHmIjTAWM2lHgm3oWkim1NoH/3jY0lI1AkgzGjKYtCkakwv\nWrNdkOXnfXrzgrIrIt5IjPrwPrr1/KUp0K4C1Il7o1/0ARPLporFSN+IDGN6\nfuRVr82uZFE6Werr/7Q/jYflf6x2QnKcuGzRQKx8jvuh7CNrXYUAfr/AqZEm\nxGzm\r\n=/kJ5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDEfdU1d0kcoZHSqIT0/6t+aXPEGvPoOVQDgr6ZyfTk7wIgPw1Wbp7hGv1DQB9uEV++1h8eX2ThgCbKxAH4zP07u8M="}],"size":2133,"noattachment":false,"key":"/race-timeout-anywhere/-/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,"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":1623021538362,"_cnpm_publish_time":1623021538362,"dist-tags":{"latest":"2.0.0"}}