{"_id":"@async-generators/filter","_rev":"2-cf07269cd5c8822ea53f352bcb67cd51","name":"@async-generators/filter","description":"filter an iterable sequence ","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@async-generators/filter","description":"filter a sequence","version":"0.1.0","author":{"name":"Meirion Hughes","email":"crakinshot@yahoo.com","url":"https://github.com/MeirionHughes"},"keywords":["async","iterator","generator","esnext","typescript"],"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/filter.git"},"bugs":{"url":"https://github.com/async-generators/filter/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},"gitHead":"4e1e3f5d2d8c3b244e01e2e9e470119ad9623218","homepage":"https://github.com/async-generators/filter#readme","_id":"@async-generators/filter@0.1.0","_npmVersion":"5.0.3","_nodeVersion":"8.5.0","_npmUser":{"name":"meirionhughes","email":"crakinshot@yahoo.com"},"dist":{"integrity":"sha512-43X0wEjz0mi0GZD0oi68otDbBb/HLu08nJOkxCkz4NTj/WPe5AkL2/lDuqqr3pFZ3L0Xh1SdZkFAfrlsq+l7pQ==","shasum":"3c2708eeb8c85cbea6bb45f56b39c5b2e4cae7fb","tarball":"https://registry.npmjs.org/@async-generators/filter/-/filter-0.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGeuTLSESvK2fHc19xIpkjKJp3YBPDxuew38nIC9gmDKAiEAy5AP1PhdMaz00Ug99OP4WUDObHFXT0nOKq+xLpUIlhw="}]},"maintainers":[{"name":"meirionhughes","email":"crakinshot@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/filter-0.1.0.tgz_1505597079378_0.05867313640192151"}},"0.1.1":{"name":"@async-generators/filter","description":"filter an iterable sequence ","version":"0.1.1","author":{"name":"Meirion Hughes","email":"crakinshot@yahoo.com","url":"https://github.com/MeirionHughes"},"keywords":["async","iterator","generator","esnext","typescript"],"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/filter.git"},"bugs":{"url":"https://github.com/async-generators/filter/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},"gitHead":"a05ff51bd715faee3cf3097c1c9e91477acc3cee","homepage":"https://github.com/async-generators/filter#readme","_id":"@async-generators/filter@0.1.1","_npmVersion":"5.0.3","_nodeVersion":"8.5.0","_npmUser":{"name":"meirionhughes","email":"crakinshot@yahoo.com"},"dist":{"integrity":"sha512-0ZThTyj3hyX5uUwVkBakgHwGdoNrddAEEXeWeWXIonKPBBNHHxpYPWjp30JZ33GjVH0tlEB4nOAODGZ+a4kqQA==","shasum":"d4316b47ec6c89f976531b1bdf12ff3b7fa5d064","tarball":"https://registry.npmjs.org/@async-generators/filter/-/filter-0.1.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF/6+Md826/xwhF+Bt+snSHASRijCiszG90Nptl0KXDUAiBHbJXxmR7xGDNobR5drRDCaJBLeu9JllqtzoA20UXl9A=="}]},"maintainers":[{"name":"meirionhughes","email":"crakinshot@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/filter-0.1.1.tgz_1505598407228_0.6317655644379556"}}},"readme":"# filter\n![logo](https://avatars1.githubusercontent.com/u/31987273?v=4&s=100)\n\nfilter an iterable sequence \n\n[![NPM version][npm-image]][npm-url]\n[![Travis Status][travis-image]][travis-url]\n[![Travis Status][codecov-image]][codecov-url]\n\n## Usage\n\n_package requires a system that supports async-iteration, either natively or via down-compiling_\n\n### Install\n```\nnpm install @async-generators/filter --save\nyarn add @async-generators/filter\n```\n\nThis package's `main` entry points to a `commonjs` distribution. \n\nAdditionally, the `module` entry points to a `es2015` distribution, which can be used by build systems, such as webpack, to directly use es2015 modules. \n\n## Api\n\n### filter(source, predicate)\n\n<code>filter()</code> iterates the source and yields any item where `await predicate(item) === true`\n\n`source` must have a `[Symbol.asyncIterator]` or `[Symbol.iterator]` property. If both are present only `[Symbol.asyncIterator]` is used. \n\n`predicate(item, index)` should return a boolean (optionally as Promise) to signal whether the item should be yielded. The second parameter is the `index` of the item as it appears in the source sequence. \n\n## Example\n\nexample.js\n```js\nconst filter = require('@async-generators/filter').default;\n\nasync function* source() {\n  yield 1; yield 2; yield 3; yield 4;\n}\n\nasync function main(){\n  for await (let item of filter(source(), x=>x > 1 && x < 4)){\n     console.log(item);\n  }\n}\n\nmain();\n```\n\nExecute with the latest node.js: \n\n```\nnode --harmony-async-iteration example.js\n```\n\n\noutput:\n```\n2\n3\n```\n## Typescript\n\nThis library is fully typed and can be imported using: \n\n```ts\nimport filter from '@async-generators/filter');\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 foo.ts\n```\n\n[npm-url]: https://npmjs.org/package/@async-generators/filter\n[npm-image]: https://img.shields.io/npm/v/@async-generators/filter.svg\n[npm-downloads]: https://img.shields.io/npm/dm/@async-generators/filter.svg\n[travis-url]: https://travis-ci.org/async-generators/filter\n[travis-image]: https://img.shields.io/travis/async-generators/filter/master.svg\n[codecov-url]: https://codecov.io/gh/async-generators/filter\n[codecov-image]: https://codecov.io/gh/async-generators/filter/branch/master/graph/badge.svg\n","maintainers":[{"name":"meirionhughes","email":"crakinshot@yahoo.com"}],"time":{"modified":"2022-04-04T16:01:20.719Z","created":"2017-09-16T21:24:40.338Z","0.1.0":"2017-09-16T21:24:40.338Z","0.1.1":"2017-09-16T21:46:48.202Z"},"homepage":"https://github.com/async-generators/filter#readme","keywords":["async","iterator","generator","esnext","typescript"],"repository":{"type":"git","url":"git+https://github.com/async-generators/filter.git"},"author":{"name":"Meirion Hughes","email":"crakinshot@yahoo.com","url":"https://github.com/MeirionHughes"},"bugs":{"url":"https://github.com/async-generators/filter/issues"},"license":"MIT","readmeFilename":"README.md"}