{"_id":"@async-generators/timeout","_rev":"4-bf8d3d4c0048e00f5285ca4fcea499b6","name":"@async-generators/timeout","description":"terminate if the source yields too slow","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@async-generators/timeout","description":"terminate if the source yields too slow","version":"0.1.0","author":{"name":"Meirion Hughes","email":"crakinshot@yahoo.com","url":"https://github.com/MeirionHughes"},"keywords":["async","iterator","generator","esnext","typescript","linq","timeout"],"license":"MIT","main":"./dist/commonjs/index.js","typings":"./dist/commonjs/index.d.ts","module":"./dist/es2015/index.js","repository":{"type":"git","url":"git+https://github.com/async-generators/timeout.git"},"bugs":{"url":"https://github.com/async-generators/timeout/issues"},"devDependencies":{"@async-generators/equal":"^0.2.1","@types/chai":"^4.0.4","@types/mocha":"^2.2.43","@types/node":"^8.0.28","chai":"^4.1.2","chai-as-promised":"^7.1.1","codecov":"^2.3.0","mocha":"^3.5.3","nyc":"^11.2.1","ts-node":"^3.3.0","typescript":"^2.5.2"},"scripts":{"test":"nyc node_modules/mocha/bin/mocha --harmony-async-iteration --require source-map-support/register --compilers ts:ts-node/register test/*.ts","build":"npm run build:commonjs && npm run build:es2015","build:commonjs":"tsc --project tsconfig.build.json --rootDir src/ --outDir ./dist/commonjs","build:es2015":"tsc --project tsconfig.build.json --rootDir src/ --outDir ./dist/es2015 --module es2015","cover":"codecov"},"engines":{"node":">=8.5.0"},"nyc":{"exclude":["node_modules/","test/","coverage/"],"extension":[".ts"],"require":["ts-node/register"],"reporter":["text-summary","lcov"],"sourceMap":true,"instrument":true},"dependencies":{},"gitHead":"b007f4ae99e4542faaad11f583e6bf8a0622f16a","homepage":"https://github.com/async-generators/timeout#readme","_id":"@async-generators/timeout@0.1.0","_npmVersion":"5.3.0","_nodeVersion":"8.5.0","_npmUser":{"name":"meirionhughes","email":"crakinshot@yahoo.com"},"dist":{"integrity":"sha512-V/n3nDi4JGB7V69mVjmqL9gTUAYrKn1fMbuEN7WGGuA2H/TiUOP+xUtxuclJNVxuKMF8PTJPRab0Fej+3X9ntg==","shasum":"173c6764305c41ac4dc1a7b70bf4ec4c10f2a8ee","tarball":"https://registry.npmjs.org/@async-generators/timeout/-/timeout-0.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCw1CKN/+CT8LnZAzBOsglwtlwEO0Ago/xUeY4xDwHrmQIgGmTIQI5PHiKxZVaKaA1DxQhKwnUA9nCNp+HqXkM6PRE="}]},"maintainers":[{"name":"meirionhughes","email":"crakinshot@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timeout-0.1.0.tgz_1508852362428_0.44058989407494664"}},"0.1.1":{"name":"@async-generators/timeout","description":"terminate if the source yields too slow","version":"0.1.1","author":{"name":"Meirion Hughes","email":"crakinshot@yahoo.com","url":"https://github.com/MeirionHughes"},"keywords":["async","iterator","generator","esnext","typescript","linq","timeout"],"license":"MIT","main":"./dist/commonjs/index.js","typings":"./dist/commonjs/index.d.ts","module":"./dist/es2015/index.js","repository":{"type":"git","url":"git+https://github.com/async-generators/timeout.git"},"bugs":{"url":"https://github.com/async-generators/timeout/issues"},"devDependencies":{"@async-generators/equal":"^0.2.1","@types/chai":"^4.0.4","@types/mocha":"^2.2.43","@types/node":"^8.0.28","chai":"^4.1.2","chai-as-promised":"^7.1.1","codecov":"^2.3.0","mocha":"^3.5.3","nyc":"^11.2.1","ts-node":"^3.3.0","typescript":"^2.5.2"},"scripts":{"test":"nyc node_modules/mocha/bin/mocha --harmony-async-iteration --require source-map-support/register --compilers ts:ts-node/register test/*.ts","build":"npm run build:commonjs && npm run build:es2015","build:commonjs":"tsc --project tsconfig.build.json --rootDir src/ --outDir ./dist/commonjs","build:es2015":"tsc --project tsconfig.build.json --rootDir src/ --outDir ./dist/es2015 --module es2015","cover":"codecov"},"engines":{"node":">=8.5.0"},"nyc":{"exclude":["node_modules/","test/","coverage/"],"extension":[".ts"],"require":["ts-node/register"],"reporter":["text-summary","lcov"],"sourceMap":true,"instrument":true},"dependencies":{},"gitHead":"f87a35a0e39e6d350f5842918cf70af0b6db0042","homepage":"https://github.com/async-generators/timeout#readme","_id":"@async-generators/timeout@0.1.1","_npmVersion":"5.4.2","_nodeVersion":"8.7.0","_npmUser":{"name":"meirionhughes","email":"crakinshot@yahoo.com"},"dist":{"integrity":"sha512-+L3lVh5cuhtlXbV+61EbhmDj9jfpv4vcir/lUllDXLnzO0f1FjJZ9434VN3IAAxMoGLRFquQw+2Moh4JgdR6og==","shasum":"3f866631677cf8b692c8caee2ec4f7fb8b16c88f","tarball":"https://registry.npmjs.org/@async-generators/timeout/-/timeout-0.1.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCz47S3NsxbEN4wK0Gi8Gbyf6UeH4Hm2UfC/VXauXQ38wIhAMa7pZ5BaEJ3VyWkZGjpoevHqe+oEZ3NyiBYq9BiqEVl"}]},"maintainers":[{"name":"meirionhughes","email":"crakinshot@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timeout-0.1.1.tgz_1508922006999_0.869218421401456"}},"0.2.0":{"name":"@async-generators/timeout","description":"terminate if the source yields too slow","version":"0.2.0","author":{"name":"Meirion Hughes","email":"crakinshot@yahoo.com","url":"https://github.com/MeirionHughes"},"keywords":["async","iterator","generator","esnext","typescript","linq","timeout"],"license":"MIT","main":"./dist/commonjs/index.js","typings":"./dist/commonjs/index.d.ts","module":"./dist/es2015/index.js","repository":{"type":"git","url":"git+https://github.com/async-generators/timeout.git"},"bugs":{"url":"https://github.com/async-generators/timeout/issues"},"devDependencies":{"@async-generators/equal":"^0.6.1","@types/chai":"^4.0.4","@types/mocha":"^2.2.43","@types/node":"^8.0.28","chai":"^4.1.2","chai-as-promised":"^7.1.1","codecov":"^2.3.0","mocha":"^3.5.3","nyc":"^11.2.1","ts-node":"^3.3.0","typescript":"^2.5.2"},"scripts":{"test":"nyc node_modules/mocha/bin/mocha --require source-map-support/register --compilers ts:ts-node/register test/*.ts","build":"npm run build:commonjs && npm run build:es2015","build:commonjs":"tsc --project tsconfig.build.json --rootDir src/ --outDir ./dist/commonjs","build:es2015":"tsc --project tsconfig.build.json --rootDir src/ --outDir ./dist/es2015 --module es2015","cover":"codecov"},"engines":{"node":">=8.5.0"},"nyc":{"exclude":["node_modules/","test/","coverage/"],"extension":[".ts"],"require":["ts-node/register"],"reporter":["text-summary","lcov"],"sourceMap":true,"instrument":true},"dependencies":{},"gitHead":"2faedcade50b3b11ee482b7d2ef8601c806703c3","homepage":"https://github.com/async-generators/timeout#readme","_id":"@async-generators/timeout@0.2.0","_npmVersion":"5.4.2","_nodeVersion":"8.7.0","_npmUser":{"name":"meirionhughes","email":"crakinshot@yahoo.com"},"dist":{"integrity":"sha512-WQ1FZ0we86aXEQntlacTv5Odp9dZ2N0hSmTvWGA878N04kcjEHEnUoOaSb9HhuUmDTXVsrMmHuce5WZYwVD6dg==","shasum":"1398047c91003be43614f790020e152e7a03556a","tarball":"https://registry.npmjs.org/@async-generators/timeout/-/timeout-0.2.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDwFTWYh5tiBH36/tIf0qpDNNAgxFCyuhBa3cxMRRl6BgIgBRZg7Td5YDuUfZNWpXYlX7RYLNDm/JJdtXyW9IF7ClA="}]},"maintainers":[{"name":"meirionhughes","email":"crakinshot@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timeout-0.2.0.tgz_1515774210370_0.20397620764560997"}},"0.3.0":{"name":"@async-generators/timeout","description":"terminate if the source yields too slow","version":"0.3.0","author":{"name":"Meirion Hughes","email":"crakinshot@yahoo.com","url":"https://github.com/MeirionHughes"},"keywords":["async","iterator","generator","esnext","typescript","linq","timeout"],"license":"MIT","main":"./dist/commonjs/index.js","typings":"./dist/commonjs/index.d.ts","module":"./dist/es2015/index.js","repository":{"type":"git","url":"git+https://github.com/async-generators/timeout.git"},"bugs":{"url":"https://github.com/async-generators/timeout/issues"},"devDependencies":{"@async-generators/equal":"^0.7.1","@types/chai":"^4.0.4","@types/mocha":"^2.2.43","@types/node":"^8.0.28","chai":"^4.1.2","chai-as-promised":"^7.1.1","codecov":"^2.3.0","mocha":"^3.5.3","nyc":"^11.2.1","ts-node":"^3.3.0","typescript":"^2.5.2"},"scripts":{"test":"nyc node_modules/mocha/bin/mocha --harmony test/*.ts","build":"npm run build:commonjs && npm run build:es2015","build:commonjs":"tsc --project tsconfig.build.json --rootDir src/ --outDir ./dist/commonjs --module commonjs","build:es2015":"tsc --project tsconfig.build.json --rootDir src/ --outDir ./dist/es2015 --module es2015","cover":"codecov"},"engines":{"node":">=9.0.0"},"nyc":{"exclude":["node_modules/","test/","coverage/"],"extension":[".ts"],"require":["source-map-support/register","ts-node/register"],"reporter":["text-summary","lcov"],"sourceMap":true,"instrument":true},"dependencies":{},"gitHead":"ebabb7bf1168228630a386fa57c1a29fa87df599","homepage":"https://github.com/async-generators/timeout#readme","_id":"@async-generators/timeout@0.3.0","_npmVersion":"5.6.0","_nodeVersion":"9.4.0","_npmUser":{"name":"meirionhughes","email":"crakinshot@yahoo.com"},"dist":{"integrity":"sha512-IfuMF2DOpzZtGPa46Va141Ir6DHmhexBQSksntpTblBARDetITogm/vP51UqMu0HsYdryBsq15hGhRzDqGFYXQ==","shasum":"98955c79373f5c7e8a609dcaac25b9d2c89dfcf1","tarball":"https://registry.npmjs.org/@async-generators/timeout/-/timeout-0.3.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD4NlU1oJyP9IgN3AuS9+cCm8Ap0B5RzWPhsoUmobnE8wIhAOHagX5zwIKOuWdLDm35llK1ERtglv0UL7CZOsBR4uhg"}]},"maintainers":[{"name":"meirionhughes","email":"crakinshot@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timeout-0.3.0.tgz_1516117287747_0.24543930031359196"}}},"readme":"# timeout\n[![logo](https://avatars1.githubusercontent.com/u/31987273?v=4&s=110)][async-url]\n\nterminate if the source yields too slow \n\n[![NPM version][npm-image]][npm-url]\n[![Travis Status][travis-image]][travis-url]\n[![Travis Status][codecov-image]][codecov-url]\n\n### Install\n```\nyarn add @async-generators/timeout\n```\n\n\nThis package's `main` entry points to a `commonjs` dist. \nThe `module` entry points to a `es2015` module dist. Both require native async-generator support, or be down-compiled with a webpack loader. \n\n## Api\n\n### timeout(source, ms)\n\n<code>timeout()</code> returns an iterable that, when iterated, wraps and iterates the source iterable. If the time taken to return `next()` is greater than `ms` then an error is thrown to signify timeout. \n\n## Example\n\nexample.js\n```js\nconst timeout = require(\"@async-generators/timeout\").default;\n\nasync function* source() {\n  yield 1;\n  await new Promise(r => setTimeout(r, 500));\n  yield 2;\n}\n\nasync function main() {\n  for await (let item of timeout(source(), 250)) {\n    console.log(item);\n  }\n}\n\nmain().catch(console.log);\n```\n\nExecute with the latest node.js: \n\n```\nnode --harmony-async-iteration example.js\n```\n\noutput:\n```\n1\nError: timed out\n```\n## Typescript\n\nThis library is fully typed and can be imported using: \n\n```ts\nimport timeout from '@async-generators/timeout');\n```\n\nIt is also possible to directly execute your [properly configured](https://stackoverflow.com/a/43694282/1657476) typescript with [ts-node](https://www.npmjs.com/package/ts-node):\n\n```\nts-node --harmony_async_iteration example.ts\n```\n\n[npm-url]: https://npmjs.org/package/@async-generators/timeout\n[npm-image]: https://img.shields.io/npm/v/@async-generators/timeout.svg\n[npm-downloads]: https://img.shields.io/npm/dm/@async-generators/timeout.svg\n[travis-url]: https://travis-ci.org/async-generators/timeout\n[travis-image]: https://img.shields.io/travis/async-generators/timeout/master.svg\n[codecov-url]: https://codecov.io/gh/async-generators/timeout\n[codecov-image]: https://codecov.io/gh/async-generators/timeout/branch/master/graph/badge.svg\n[async-url]: https://github.com/async-generators","maintainers":[{"name":"meirionhughes","email":"crakinshot@yahoo.com"}],"time":{"modified":"2022-04-04T16:01:22.836Z","created":"2017-10-24T13:39:23.352Z","0.1.0":"2017-10-24T13:39:23.352Z","0.1.1":"2017-10-25T09:00:07.963Z","0.2.0":"2018-01-12T16:23:33.461Z","0.3.0":"2018-01-16T15:41:30.402Z"},"homepage":"https://github.com/async-generators/timeout#readme","keywords":["async","iterator","generator","esnext","typescript","linq","timeout"],"repository":{"type":"git","url":"git+https://github.com/async-generators/timeout.git"},"author":{"name":"Meirion Hughes","email":"crakinshot@yahoo.com","url":"https://github.com/MeirionHughes"},"bugs":{"url":"https://github.com/async-generators/timeout/issues"},"license":"MIT","readmeFilename":"README.md"}