{"_id":"@async-generators/map","_rev":"1-e06ffc49e20db36dae7d6db4d6ff6695","name":"@async-generators/map","description":"map values of an iterable sequence","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@async-generators/map","description":"map values of an iterable sequence","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/map.git"},"bugs":{"url":"https://github.com/async-generators/map/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},"homepage":"https://github.com/async-generators/map#readme","_id":"@async-generators/map@0.1.0","_npmVersion":"5.0.3","_nodeVersion":"8.5.0","_npmUser":{"name":"meirionhughes","email":"crakinshot@yahoo.com"},"dist":{"integrity":"sha512-BMcuLtZHIefL5yuqOT9hACkIbduOH17IgjjlpiIM8HcSmkyhYZavbHYcmQKnR10ATNGtVtTU9Yc81EDrthAFIw==","shasum":"07d6e9299010937986ddcf3aa8904ed69cccbccc","tarball":"https://registry.npmjs.org/@async-generators/map/-/map-0.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDo4a7LpmeVdU4ScYhdm5Sq8Kw2DTYaHD8s/MM/BeE20AiAZs2Zg/9pj+dTQTK2gSVKEr/m8Nm3a0wqwqHhjVlxo5A=="}]},"maintainers":[{"name":"meirionhughes","email":"crakinshot@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/map-0.1.0.tgz_1505602916262_0.19102189363911748"}}},"readme":"# map\n![logo](https://avatars1.githubusercontent.com/u/31987273?v=4&s=100)\n\nmap items of an iterable sequence to another value\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/map --save\nyarn add @async-generators/map\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### map(source, selector)\n\n<code>map()</code> iterates the source and yields `await selector(item, index)`\n\n`source` must have a `[Symbol.asyncIterator]` or `[Symbol.iterator]` property. If both are present only `[Symbol.asyncIterator]` is used. \n\n`selector(item, index)` should return the object to yield.  The second parameter is the `index` of the item as it appeared in the source sequence. \n\n## Example\n\nexample.js\n```js\nconst map = require('@async-generators/map').default;\n\nasync function main() {\n\n  async function* source() {\n    yield \"hello\"; yield \"world\";\n  }\n\n  let mapped = map(source(),\n    (x, i) => {\n      return {\n        value: x.toString(),\n        index: i\n      }\n    });\n\n  for await (let item of mapped) {\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```\n{ value: 'hello', index: 0 }\n{ value: 'world', index: 1 }\n```\n## Typescript\n\nThis library is fully typed and can be imported using: \n\n```ts\nimport filter from '@async-generators/map');\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/map\n[npm-image]: https://img.shields.io/npm/v/@async-generators/map.svg\n[npm-downloads]: https://img.shields.io/npm/dm/@async-generators/map.svg\n[travis-url]: https://travis-ci.org/async-generators/map\n[travis-image]: https://img.shields.io/travis/async-generators/map/master.svg\n[codecov-url]: https://codecov.io/gh/async-generators/map\n[codecov-image]: https://codecov.io/gh/async-generators/map/branch/master/graph/badge.svg\n","maintainers":[{"name":"meirionhughes","email":"crakinshot@yahoo.com"}],"time":{"modified":"2022-04-04T16:01:21.964Z","created":"2017-09-16T23:01:57.138Z","0.1.0":"2017-09-16T23:01:57.138Z"},"homepage":"https://github.com/async-generators/map#readme","keywords":["map","select","async","iterator","generator","esnext","typescript","linq"],"repository":{"type":"git","url":"git+https://github.com/async-generators/map.git"},"author":{"name":"Meirion Hughes","email":"crakinshot@yahoo.com","url":"https://github.com/MeirionHughes"},"bugs":{"url":"https://github.com/async-generators/map/issues"},"license":"MIT","readmeFilename":"README.md"}