{"_id":"@async-generators/to-array","_rev":"1-40435f7c2f4f8db91678b0134e26d4f0","name":"@async-generators/to-array","description":"consume an iterable and return all items as an array","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@async-generators/to-array","description":"consume an iterable and return all items as an array","version":"0.1.0","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/to-array.git"},"bugs":{"url":"https://github.com/async-generators/to-array/issues"},"dependencies":{"@async-generators/iterable":"^0.2.0"},"devDependencies":{"@async-generators/equal":"^0.4.0","@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":"176bb72ecb2320af54817ccc55beba3411ba26a9","homepage":"https://github.com/async-generators/to-array#readme","_id":"@async-generators/to-array@0.1.0","_npmVersion":"5.0.3","_nodeVersion":"8.5.0","_npmUser":{"name":"meirionhughes","email":"crakinshot@yahoo.com"},"dist":{"integrity":"sha512-hGxQPzeEOBE6nhqLVK4QSqnjQohmMfy51s5Uu0XEoKy6vISBDPU1xNqY/3Rql8fMkP4FvW+zh0BMQ6OrBIAtqw==","shasum":"7aeb257508aafb4fccd84e10d90927e7aec4ef37","tarball":"https://registry.npmjs.org/@async-generators/to-array/-/to-array-0.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICKLVifDb4/YKV39E+r+GQSrPXSL1Ku76IGkbI2irbO8AiBJPScpOqawyOEJBqbZLEXA1GghiMhe2g/OS/3g4+itEg=="}]},"maintainers":[{"name":"meirionhughes","email":"crakinshot@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/to-array-0.1.0.tgz_1506195489016_0.058745704824104905"}}},"readme":"# to-array\n![logo](https://avatars1.githubusercontent.com/u/31987273?v=4&s=100)\n\nconsume an iterable and return an array of all items. \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/to-array --save\nyarn add @async-generators/to-array\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### toArray(source)\n\n<code>toArray()</code> iterates `source`, adds each item to an array and returns the array when the `source()` iterator completes. \n\n## Example\n\nexample.js\n```js\nconst toArray = require('@async-generators/to-array').default;\n\nasync function main() {\n\n  let source = async function* () {   \n    yield 1; yield 2; yield 3; yield 4;\n  }\n\n  let result = await toArray(source());\n\n  console.log(result);\n}\n\nmain();\n\n```\n\nExecute with the latest node.js: \n\n```\nnode --harmony-async-iteration example.js\n```\n\n\noutput:\n```\n[ 1, 2, 3, 4 ]\n```\n## Typescript\n\nThis library is fully typed and can be imported using: \n\n```ts\nimport toArray from '@async-generators/to-array');\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/to-array\n[npm-image]: https://img.shields.io/npm/v/@async-generators/to-array.svg\n[npm-downloads]: https://img.shields.io/npm/dm/@async-generators/to-array.svg\n[travis-url]: https://travis-ci.org/async-generators/to-array\n[travis-image]: https://img.shields.io/travis/async-generators/to-array/master.svg\n[codecov-url]: https://codecov.io/gh/async-generators/to-array\n[codecov-image]: https://codecov.io/gh/async-generators/to-array/branch/master/graph/badge.svg\n","maintainers":[{"name":"meirionhughes","email":"crakinshot@yahoo.com"}],"time":{"modified":"2022-04-04T16:01:23.629Z","created":"2017-09-23T19:38:09.913Z","0.1.0":"2017-09-23T19:38:09.913Z"},"homepage":"https://github.com/async-generators/to-array#readme","keywords":["async","iterator","generator","esnext","typescript","linq"],"repository":{"type":"git","url":"git+https://github.com/async-generators/to-array.git"},"author":{"name":"Meirion Hughes","email":"crakinshot@yahoo.com","url":"https://github.com/MeirionHughes"},"bugs":{"url":"https://github.com/async-generators/to-array/issues"},"license":"MIT","readmeFilename":"README.md"}