{"_id":"@async-generators/first","_rev":"4-b6676ace2720c3ea31ccefcd75a0c49b","name":"@async-generators/first","description":"get the first (predicated) item from a source iterable","dist-tags":{"latest":"0.2.2"},"versions":{"0.1.0":{"name":"@async-generators/first","description":"get the first (predicated) item from a source iterable","version":"0.1.0","author":{"name":"Meirion Hughes","email":"crakinshot@yahoo.com","url":"https://github.com/MeirionHughes"},"keywords":["map","select","async","iterator","generator","esnext","typescript","linq"],"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/first.git"},"bugs":{"url":"https://github.com/async-generators/first/issues"},"dependencies":{"@async-generators/iterable":"^0.3.0"},"devDependencies":{"@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":"0f22466bee9a655908652efc3c2eb0c622abbbb9","homepage":"https://github.com/async-generators/first#readme","_id":"@async-generators/first@0.1.0","_npmVersion":"5.3.0","_nodeVersion":"8.5.0","_npmUser":{"name":"meirionhughes","email":"crakinshot@yahoo.com"},"dist":{"integrity":"sha512-pKytsMZ2ymYhpwVGrSTODm6ubsXVfPgPWu8B9b4QsMnd83tjgxFQaq5bQxW+YV2mLmo1GEDQEu1o4G3T6REayw==","shasum":"d2a9d9e5f69fd072dcf2a54dbeb816acc84b1089","tarball":"https://registry.npmjs.org/@async-generators/first/-/first-0.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDBbOglyNuytmQzE/kDg40m8J6uKd1IfwSrmfRGXQWXQwIhAIrFog2zf9JnuF+7J6vBuOejaNqnpn4NVXBZKWDWkZ2D"}]},"maintainers":[{"name":"meirionhughes","email":"crakinshot@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/first-0.1.0.tgz_1506348592375_0.04368342086672783"}},"0.2.0":{"name":"@async-generators/first","description":"get the first (predicated) item from a source iterable","version":"0.2.0","author":{"name":"Meirion Hughes","email":"crakinshot@yahoo.com","url":"https://github.com/MeirionHughes"},"keywords":["map","select","async","iterator","generator","esnext","typescript","linq"],"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/first.git"},"bugs":{"url":"https://github.com/async-generators/first/issues"},"dependencies":{"@async-generators/iterable":"^0.3.0"},"devDependencies":{"@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":"26db3ae82a1da3b6e98e906819057f3255d4603d","homepage":"https://github.com/async-generators/first#readme","_id":"@async-generators/first@0.2.0","_npmVersion":"5.3.0","_nodeVersion":"8.5.0","_npmUser":{"name":"meirionhughes","email":"crakinshot@yahoo.com"},"dist":{"integrity":"sha512-+fAStoZfR3nRQC2dUikKgXLyMToe7U1uqPyXVCiFzhW4GWaSW+Z3vlhdfM69GXX2YTN79ymBmkpxPA7ZxiGtYQ==","shasum":"1eb6ec8ca7f37c8f7ab1463926ad6c81091ba993","tarball":"https://registry.npmjs.org/@async-generators/first/-/first-0.2.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC+gloquluCRio+TjitACPvHsH2kIttefr+2jZS7yFlBgIhALqst+ONcdY21NYN4f/y//01XYyleVGGFFAQ8FQ5ysBD"}]},"maintainers":[{"name":"meirionhughes","email":"crakinshot@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/first-0.2.0.tgz_1506352418423_0.06990162096917629"}},"0.2.1":{"name":"@async-generators/first","description":"get the first (predicated) item from a source iterable","version":"0.2.1","author":{"name":"Meirion Hughes","email":"crakinshot@yahoo.com","url":"https://github.com/MeirionHughes"},"keywords":["map","select","async","iterator","generator","esnext","typescript","linq"],"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/first.git"},"bugs":{"url":"https://github.com/async-generators/first/issues"},"dependencies":{"@async-generators/iterable":"^0.3.0"},"devDependencies":{"@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":"001b5a56d92e3ca6e2b904ca070fa2be25ef7d24","homepage":"https://github.com/async-generators/first#readme","_id":"@async-generators/first@0.2.1","_npmVersion":"5.3.0","_nodeVersion":"8.5.0","_npmUser":{"name":"meirionhughes","email":"crakinshot@yahoo.com"},"dist":{"integrity":"sha512-IakFN9OST87b9ADy9KKAeXAyXbx1FriySZJyzJr6pkJ3uAcZ+v1FoMZ3LXkND3eBC6s3JauICGqxhr2iRu/y7A==","shasum":"2d4264286956e08fdfe1e8595fc42dba5c866527","tarball":"https://registry.npmjs.org/@async-generators/first/-/first-0.2.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDriuM8bO4A2AXAV7CUgrWzW0/CG3jwauFA/vuOj5akHQIgH+QQXySIy8W71U1OuQgOTsJ52l7TudhJ5yBAmjMNulU="}]},"maintainers":[{"name":"meirionhughes","email":"crakinshot@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/first-0.2.1.tgz_1506353520822_0.5194886834360659"}},"0.2.2":{"name":"@async-generators/first","description":"get the first (predicated) item from a source iterable","version":"0.2.2","author":{"name":"Meirion Hughes","email":"crakinshot@yahoo.com","url":"https://github.com/MeirionHughes"},"keywords":["async","iterator","generator","esnext","typescript","linq"],"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/first.git"},"bugs":{"url":"https://github.com/async-generators/first/issues"},"dependencies":{"@async-generators/iterable":"^0.3.0"},"devDependencies":{"@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":"fad189911ed9f6e9f35b568f306ff1fcb8a92f33","homepage":"https://github.com/async-generators/first#readme","_id":"@async-generators/first@0.2.2","_npmVersion":"5.3.0","_nodeVersion":"8.5.0","_npmUser":{"name":"meirionhughes","email":"crakinshot@yahoo.com"},"dist":{"integrity":"sha512-eip766Ej2yW3TdRfXDxQ4FkgKo3VM66XjBrpbj2xiuj8xjzixmQA/PwTlkRxOqNg589gSxBKePr/qb8/G5a7Wg==","shasum":"4130ce3d53b57fb75486446a8d14b91050dfb990","tarball":"https://registry.npmjs.org/@async-generators/first/-/first-0.2.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCOuBFAv7EHKa6yxuM2rLkddodzdIVgQuFmajWIefb40gIgCN9yY5dsVCDjaZsVCbdcZxW/zVofwWqLY/ThmGqMu8w="}]},"maintainers":[{"name":"meirionhughes","email":"crakinshot@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/first-0.2.2.tgz_1506353552845_0.2608504253439605"}}},"readme":"# first\n[![logo](https://avatars1.githubusercontent.com/u/31987273?v=4&s=100)][async-url]\n\n\nget the first (predicated) item from a source iterable\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/first --save\nyarn add @async-generators/first\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### first(source [,predicate])\n\n<code>first()</code> iterates `source` and returns the first item where `predicate(item) == true`. if `predicate` is `undefined` then it simply returns the first item. if `source` contains no items, or `predicate()` always returns false, then `first()` returns `undefined`.\n\n`source` must have a `[Symbol.asyncIterator]` or `[Symbol.iterator]` property. If both are present only `[Symbol.asyncIterator]` is used. \n\n## Example\n\nexample.js\n```js\nconst first = require('@async-generators/first').default;\n\nasync function* source() {\n  yield 1; yield 2; yield 3; yield 4;\n}\n\nasync function main() {\n  console.log(await first(source(), x => x > 1));\n}\n\nmain();\n\n```\n\nExecute with the latest node.js: \n\n```\nnode --harmony-async-iteration example.js\n```\n\noutput:\n```\n2\n```\n## Typescript\n\nThis library is fully typed and can be imported using: \n\n```ts\nimport first from '@async-generators/first');\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/first\n[npm-image]: https://img.shields.io/npm/v/@async-generators/first.svg\n[npm-downloads]: https://img.shields.io/npm/dm/@async-generators/first.svg\n[travis-url]: https://travis-ci.org/async-generators/first\n[travis-image]: https://img.shields.io/travis/async-generators/first/master.svg\n[codecov-url]: https://codecov.io/gh/async-generators/first\n[codecov-image]: https://codecov.io/gh/async-generators/first/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:21.109Z","created":"2017-09-25T14:09:53.286Z","0.1.0":"2017-09-25T14:09:53.286Z","0.2.0":"2017-09-25T15:13:39.429Z","0.2.1":"2017-09-25T15:32:01.787Z","0.2.2":"2017-09-25T15:32:33.736Z"},"homepage":"https://github.com/async-generators/first#readme","keywords":["async","iterator","generator","esnext","typescript","linq"],"repository":{"type":"git","url":"git+https://github.com/async-generators/first.git"},"author":{"name":"Meirion Hughes","email":"crakinshot@yahoo.com","url":"https://github.com/MeirionHughes"},"bugs":{"url":"https://github.com/async-generators/first/issues"},"license":"MIT","readmeFilename":"README.md"}