{"id":16644214,"url":"https://github.com/75lb/race-timeout-anywhere","last_synced_at":"2026-04-25T13:05:10.181Z","repository":{"id":65479541,"uuid":"150487432","full_name":"75lb/race-timeout-anywhere","owner":"75lb","description":"An isomorphic, load-anywhere timeout function for use with Promise.race.","archived":false,"fork":false,"pushed_at":"2021-06-06T23:18:56.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-25T08:01:25.896Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/75lb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-26T20:39:52.000Z","updated_at":"2021-06-06T23:18:56.000Z","dependencies_parsed_at":"2023-01-25T08:25:15.158Z","dependency_job_id":null,"html_url":"https://github.com/75lb/race-timeout-anywhere","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Frace-timeout-anywhere","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Frace-timeout-anywhere/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Frace-timeout-anywhere/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Frace-timeout-anywhere/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/75lb","download_url":"https://codeload.github.com/75lb/race-timeout-anywhere/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243172100,"owners_count":20247887,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T08:10:47.835Z","updated_at":"2025-12-25T13:56:44.817Z","avatar_url":"https://github.com/75lb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"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\u0026copy; 2018-21 Lloyd Brookes \\\u003c75pound@gmail.com\\\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F75lb%2Frace-timeout-anywhere","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F75lb%2Frace-timeout-anywhere","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F75lb%2Frace-timeout-anywhere/lists"}