{"id":19677710,"url":"https://github.com/3rd-eden/borked","last_synced_at":"2025-07-22T11:04:23.486Z","repository":{"id":66001988,"uuid":"188481687","full_name":"3rd-Eden/borked","owner":"3rd-Eden","description":"Cancel async functions early when they are borked.","archived":false,"fork":false,"pushed_at":"2019-05-28T23:40:37.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-06T04:02:54.127Z","etag":null,"topics":["async","function","promise","timeout"],"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/3rd-Eden.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-24T20:10:41.000Z","updated_at":"2019-05-28T23:40:34.000Z","dependencies_parsed_at":"2023-04-15T20:17:27.198Z","dependency_job_id":null,"html_url":"https://github.com/3rd-Eden/borked","commit_stats":{"total_commits":4,"total_committers":2,"mean_commits":2.0,"dds":0.25,"last_synced_commit":"7874046f5eb5e357b653758da6d47cd59d121b6b"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/3rd-Eden/borked","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3rd-Eden%2Fborked","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3rd-Eden%2Fborked/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3rd-Eden%2Fborked/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3rd-Eden%2Fborked/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/3rd-Eden","download_url":"https://codeload.github.com/3rd-Eden/borked/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3rd-Eden%2Fborked/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266481732,"owners_count":23935938,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["async","function","promise","timeout"],"created_at":"2024-11-11T17:35:10.217Z","updated_at":"2025-07-22T11:04:23.467Z","avatar_url":"https://github.com/3rd-Eden.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `BORKED`\n\n\u003e [borked:](https://www.urbandictionary.com/define.php?term=borked)\n\u003e To have broken something so entirely, you break the words used to describe the item.\n\n`borked` is a micro utility designed for a very specific use-case. Timing out\nasync functions (caveat: it does not cancel the long running promise).\n\nWhen you `await` an async function or promise in JavaScript it will wait with\nthe executing the rest of the function until async function returns or the\npromise resolves/rejects. So if it never resolves, completes because it's\nborked, your whole function will just be waiting indefinitely.\n\nWe solve this by executing your async function/promise with an `Promise.race`\nwhere we will reject the promise when the supplied timeout is reached.\n\n## Installation\n\nThe package in published in the public npm registry and can be installed by\nrunning.\n\n```bash\nnpm install --save borked\n```\n\n## Usage\n\n```js\nimport bork from 'borked';\n\nconst borked = bork(2000);\n\n//\n// Normally in your code you would do:\n//\n// await example();\n//\n// And wait for the results, with borked you await `borked`\n//\ntry { await borked(example()) }\ncatch (e) {\n  console.log('called after 2000 ms');\n}\n```\n\n```js\nimport { borked } from 'borked';\n\ntry { await borked(example()) }\ncatch (e) {\n  console.log('called after 2000 ms');\n}\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3rd-eden%2Fborked","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F3rd-eden%2Fborked","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3rd-eden%2Fborked/lists"}