{"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":{"integrity":"sha512-2Vb43Q/kdodGKBMDbbXPYxrEI8uiZgo6zZNRoWs9R7y77XLHLemxGIrWMslRAoggdkqdjTXQg4RdMJgSFxO/9Q==","shasum":"1842415dababf36a5948ef2cf9abbc8d6ff24448","tarball":"http://registry-npm.ywwl.com/race-timeout-anywhere/download/race-timeout-anywhere-0.1.0.tgz","fileCount":8,"unpackedSize":4808,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbq+7ACRA9TVsSAnZWagAA26gP+wQyyzg9Xn1+jhJiRmg+\nGg5Wqy/KUldcXVQ6cBjjvI2/y/PxDxdk56qE61G/PuCgQP8brfvjhmlrmVPE\n/6dH8GkGoiSZMFED4JANStK6675RX5WFdwpcK91vzDFUAdGHiYz8gbV72FlT\nM0TgjY9wpiU60a6OsXRRubMrBXRvG+SlhcWL8edrCmaXNRHcowpPnBcrkZVU\nRHj627DASNTXgJv5H9rQ37C888qlZiMBcO2qPPF4dP2b24vAOy9N22Wpcs9l\nhxczeKKnSAUGj9K+WvE29PTEudLfosldMb05euxk8ROvpqiUNanVcL8FjIOY\nNYzl9+YLMr6sxe+eJggxP1PTz2YAOhBwIYME+4czdrRYmRXNdkkTgJt9fsts\nFXBW/2QdrACGK1yWtTwiACcl4sqZfWzGTHUm7mslBcA2BKeLD5DULM2QxxxA\nxWUZVaUNF/HQnLscGnOvmeygwGYn7W1313Z9U6hFsa7xxp4z5kn4tdHkI2F4\nDU4FI8IC/mKayknA1zVhWpqLwOtjlAkbjBM50reIP4wG5eYdD4VTsVTcHiTl\nz7nB6HSOiMt7004UhsezvWotLCleiWjlC1saAQh1RGfdJTLkJ316XAPKQJ1P\nQ+Z0vFB2NtznId9ntB/b4Z6wuz5fYdknqDaoKMdjETiI4ptBmLRv2vv+1PX+\nOIRb\r\n=bSZA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDlp3bn0oOEYtUvdCoeVCcCF/2gNclbZWrmCqGuDyavyQIgTFP1XfTaqq2FAJFxotcec9huW6K4Td9bDHPW1pq8u0Q="}],"size":2221,"noattachment":false,"key":"/race-timeout-anywhere/-/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,"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":1537994431669,"_cnpm_publish_time":1537994431669,"dist-tags":{"latest":"2.0.0"}}