{"id":18217331,"url":"https://github.com/alsotang/ko-timeout","last_synced_at":"2025-04-02T21:30:54.803Z","repository":{"id":57289360,"uuid":"46189040","full_name":"alsotang/ko-timeout","owner":"alsotang","description":null,"archived":false,"fork":false,"pushed_at":"2017-10-19T03:33:11.000Z","size":6,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-17T16:12:15.131Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/alsotang.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":"2015-11-14T19:33:41.000Z","updated_at":"2017-10-29T13:56:05.000Z","dependencies_parsed_at":"2022-09-20T06:22:35.095Z","dependency_job_id":null,"html_url":"https://github.com/alsotang/ko-timeout","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alsotang%2Fko-timeout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alsotang%2Fko-timeout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alsotang%2Fko-timeout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alsotang%2Fko-timeout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alsotang","download_url":"https://codeload.github.com/alsotang/ko-timeout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246895644,"owners_count":20851307,"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-11-03T17:04:51.338Z","updated_at":"2025-04-02T21:30:54.525Z","avatar_url":"https://github.com/alsotang.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ko-timeout\n\n**deprecated please use https://github.com/sindresorhus/delay**\n\n[![Build Status](https://travis-ci.org/alsotang/ko-timeout.svg?branch=master)](https://travis-ci.org/alsotang/ko-timeout)\n\n## usage\n\n```js\ntimeout(gen, ms)\n```\n\n`gen` - a genarator function\n\n`ms` - millisecond. can use '3s' or '200ms', which https://www.npmjs.com/package/ms support\n\nif timeout, `err.name` will be `CoTimeoutError`\n\n## example\n\n### should timeout\n\n```js\ntry {\n  yield timeout(function * () {\n    yield sleep(50)\n  }, 20)\n} catch (e) {\n  e.name.should.eql('CoTimeoutError')\n  e.message.should.eql('timeout: exceed 20ms')\n}\n```\n\n### should get return value\n\n\n```js\nvar value = yield timeout(function * () {\n  yield sleep(10)\n  return 30;\n}, 20)\n\nvalue.should.eql(30)\n```\n\n## license\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falsotang%2Fko-timeout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falsotang%2Fko-timeout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falsotang%2Fko-timeout/lists"}