{"_id":"through2-map","_rev":"56345","name":"through2-map","description":"A through2 to create an Array.prototype.map analog for streams.","dist-tags":{"latest":"3.0.0"},"maintainers":[{"name":"bryce","email":""}],"time":{"modified":"2021-06-03T10:17:09.000Z","created":"2013-08-06T05:12:20.429Z","3.0.0":"2016-11-05T18:50:49.365Z","2.0.0":"2015-06-17T06:45:28.251Z","1.4.0":"2014-06-10T07:07:38.316Z","1.3.0":"2014-06-04T18:04:09.195Z","1.2.1":"2013-12-13T19:07:49.824Z","1.2.0":"2013-09-20T17:46:45.107Z","1.1.0":"2013-08-07T06:34:55.255Z","1.0.2":"2013-08-06T05:18:42.091Z","1.0.1":"2013-08-06T05:14:34.407Z","1.0.0":"2013-08-06T05:12:20.429Z"},"users":{"nkbt":true,"juicypasta":true,"artskydj":true,"greendwin":true,"pnevares":true,"pengzhisun":true,"vladan":true,"jmorris":true,"narayanmp":true,"ex.zach.ly":true,"vinchik":true,"jabbalaci":true,"gokkun":true,"x0000ff":true,"dyohns":true,"jun-oka":true,"mrzmmr":true,"mickeyzhou":true,"tvvixie":true,"kiinlam":true,"shivayl":true},"author":{"name":"Bryce B. Baril"},"repository":{"type":"git","url":"git+ssh://git@github.com/brycebaril/through2-map.git"},"versions":{"3.0.0":{"name":"through2-map","version":"3.0.0","description":"A through2 to create an Array.prototype.map analog for streams.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"node test/"},"repository":{"type":"git","url":"git+ssh://git@github.com/brycebaril/through2-map.git"},"keywords":["streams","through","through2","map"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-map/issues"},"jshintConfig":{"asi":true,"globalstrict":true,"validthis":true,"eqnull":true,"node":true,"loopfunc":true,"newcap":false,"eqeqeq":false},"devDependencies":{"tape":"~4.0.0","stream-spigot":"~3.0.5","terminus":"~1.0.12"},"dependencies":{"through2":"~2.0.0","xtend":"^4.0.0"},"gitHead":"8a482d218bdf2de40bf867a1f28ffa9fa0a3b315","homepage":"https://github.com/brycebaril/through2-map#readme","_id":"through2-map@3.0.0","_shasum":"a6c3026ce63b4898a997d540506b66ffd970f271","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"dist":{"shasum":"a6c3026ce63b4898a997d540506b66ffd970f271","size":4241,"noattachment":false,"key":"/through2-map/-/through2-map-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-map/download/through2-map-3.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/through2-map-3.0.0.tgz_1478371847646_0.8123708353377879"},"publish_time":1478371849365,"_cnpm_publish_time":1478371849365,"_hasShrinkwrap":false},"2.0.0":{"name":"through2-map","version":"2.0.0","description":"A through2 to create an Array.prototype.map analog for streams.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"node test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-map.git"},"keywords":["streams","through","through2","map"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-map/issues"},"jshintConfig":{"asi":true,"globalstrict":true,"validthis":true,"eqnull":true,"node":true,"loopfunc":true,"newcap":false,"eqeqeq":false},"devDependencies":{"tape":"~4.0.0","stream-spigot":"~3.0.5","terminus":"~1.0.12"},"dependencies":{"through2":"~2.0.0","xtend":"^4.0.0"},"gitHead":"2ba6ff9dcd153722e1141d64d0783f9fd7b8771e","homepage":"https://github.com/brycebaril/through2-map","_id":"through2-map@2.0.0","_shasum":"46984672e2c2d8a41e176f56fb575beb64d8ed7e","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"dist":{"shasum":"46984672e2c2d8a41e176f56fb575beb64d8ed7e","size":3303,"noattachment":false,"key":"/through2-map/-/through2-map-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-map/download/through2-map-2.0.0.tgz"},"publish_time":1434523528251,"_cnpm_publish_time":1434523528251,"_hasShrinkwrap":false},"1.4.0":{"name":"through2-map","version":"1.4.0","description":"A through2 to create an Array.prototype.map analog for streams.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"node test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-map.git"},"keywords":["streams","through","through2","map"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-map/issues"},"jshintConfig":{"asi":true,"globalstrict":true,"validthis":true,"eqnull":true,"node":true,"loopfunc":true,"newcap":false,"eqeqeq":false},"devDependencies":{"tape":"~2.13.2","stream-spigot":"~3.0.4","concat-stream":"~1.4.6"},"dependencies":{"terminus":"~1.0.10","through2":"~0.5.1","xtend":"^3.0.0"},"homepage":"https://github.com/brycebaril/through2-map","_id":"through2-map@1.4.0","_shasum":"7cb13e7c9ef00c7a93c742567f9d2e51168ff7f5","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"dist":{"shasum":"7cb13e7c9ef00c7a93c742567f9d2e51168ff7f5","size":3338,"noattachment":false,"key":"/through2-map/-/through2-map-1.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-map/download/through2-map-1.4.0.tgz"},"publish_time":1402384058316,"_cnpm_publish_time":1402384058316,"_hasShrinkwrap":false},"1.3.0":{"name":"through2-map","version":"1.3.0","description":"A through2 to create an Array.prototype.map analog for streams.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"node test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-map.git"},"keywords":["streams","through","through2","map"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-map/issues"},"jshintConfig":{"asi":true,"globalstrict":true,"validthis":true,"eqnull":true,"node":true,"loopfunc":true,"newcap":false,"eqeqeq":false},"devDependencies":{"tape":"~2.4.0","stream-spigot":"~3.0.3","concat-stream":"~1.4.1"},"dependencies":{"terminus":"~1.0.8","through2":"~0.4.1","xtend":"^3.0.0"},"homepage":"https://github.com/brycebaril/through2-map","_id":"through2-map@1.3.0","_shasum":"a27f1a741285aabe6dc526bec4ca4d53073d39a7","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"dist":{"shasum":"a27f1a741285aabe6dc526bec4ca4d53073d39a7","size":3266,"noattachment":false,"key":"/through2-map/-/through2-map-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-map/download/through2-map-1.3.0.tgz"},"publish_time":1401905049195,"_cnpm_publish_time":1401905049195,"_hasShrinkwrap":false},"1.2.1":{"name":"through2-map","version":"1.2.1","description":"A through2 to create an Array.prototype.map analog for streams.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"node test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-map.git"},"keywords":["streams","through","through2","map"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-map/issues"},"devDependencies":{"tape":"~2.3.0","stream-spigot":"~3.0.1","concat-stream":"~1.2.1"},"dependencies":{"through2":"~0.2.3","terminus":"~1.0.4"},"readmeFilename":"README.md","homepage":"https://github.com/brycebaril/through2-map","_id":"through2-map@1.2.1","dist":{"shasum":"5d9bf15f29f48815de2da347581eaac89c402de6","size":2917,"noattachment":false,"key":"/through2-map/-/through2-map-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-map/download/through2-map-1.2.1.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1386961669824,"_cnpm_publish_time":1386961669824,"_hasShrinkwrap":false},"1.2.0":{"name":"through2-map","version":"1.2.0","description":"A through2 to create an Array.prototype.map analog for streams.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"tap test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-map.git"},"keywords":["streams","through","through2","map"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-map/issues"},"devDependencies":{"tape":"~1.0.4","tap":"~0.4.3","stream-spigot":"~2.0.0","concat-stream":"~1.0.0"},"dependencies":{"through2":"~0.2.2"},"readmeFilename":"README.md","_id":"through2-map@1.2.0","dist":{"shasum":"c175154e27b2936d1576a540f6867efd199b6a9a","size":2888,"noattachment":false,"key":"/through2-map/-/through2-map-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-map/download/through2-map-1.2.0.tgz"},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1379699205107,"_cnpm_publish_time":1379699205107,"_hasShrinkwrap":false},"1.1.0":{"name":"through2-map","version":"1.1.0","description":"A through2 to create an Array.prototype.map analog for streams.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"tap test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-map.git"},"keywords":["streams","through","through2","map"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-map/issues"},"devDependencies":{"tape":"~1.0.4","tap":"~0.4.3","stream-spigot":"~2.0.0","concat-stream":"~1.0.0"},"dependencies":{"through2":"~0.1.0"},"readmeFilename":"README.md","_id":"through2-map@1.1.0","dist":{"shasum":"82db87b7469dd0548efc49e7d5ee622d778e6875","size":2886,"noattachment":false,"key":"/through2-map/-/through2-map-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-map/download/through2-map-1.1.0.tgz"},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1375857295255,"_cnpm_publish_time":1375857295255,"_hasShrinkwrap":false},"1.0.2":{"name":"through2-map","version":"1.0.2","description":"A through2 to create an Array.prototype.map analog for streams.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"tap test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-map.git"},"keywords":["streams","through","through2","map"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-map/issues"},"devDependencies":{"tape":"~1.0.4","tap":"~0.4.3","stream-spigot":"~2.0.0","concat-stream":"~1.0.0"},"dependencies":{"through2":"~0.1.0"},"readmeFilename":"README.md","_id":"through2-map@1.0.2","dist":{"shasum":"46d946bb6de2b8ebe0c08f5cdaa51a260f67aecb","size":2839,"noattachment":false,"key":"/through2-map/-/through2-map-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-map/download/through2-map-1.0.2.tgz"},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1375766322091,"_cnpm_publish_time":1375766322091,"_hasShrinkwrap":false},"1.0.1":{"name":"through2-map","version":"1.0.1","description":"A through2 to create an Array.prototype.map analog for streams.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"tap test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-map.git"},"keywords":["streams","through","through2","map"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-map/issues"},"devDependencies":{"tape":"~1.0.4","tap":"~0.4.3","stream-spigot":"~2.0.0"},"dependencies":{"through2":"~0.1.0","concat-stream":"~1.0.0"},"readmeFilename":"README.md","_id":"through2-map@1.0.1","dist":{"shasum":"85765409c9ed375a522748ba37480b5146aa94fc","size":2836,"noattachment":false,"key":"/through2-map/-/through2-map-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-map/download/through2-map-1.0.1.tgz"},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1375766074407,"_cnpm_publish_time":1375766074407,"_hasShrinkwrap":false},"1.0.0":{"name":"through2-map","version":"1.0.0","description":"A through2 to create an Array.prototype.map analog for streams.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"tap test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-map.git"},"keywords":["streams","through","through2","map"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-map/issues"},"devDependencies":{"tape":"~1.0.4","tap":"~0.4.3","stream-spigot":"~2.0.0"},"dependencies":{"through2":"~0.1.0","concat-stream":"~1.0.0"},"readmeFilename":"README.md","_id":"through2-map@1.0.0","dist":{"shasum":"5e38cc977e5d252d593cb478b242a99ec5d9c046","size":2806,"noattachment":false,"key":"/through2-map/-/through2-map-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-map/download/through2-map-1.0.0.tgz"},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1375765940429,"_cnpm_publish_time":1375765940429,"_hasShrinkwrap":false}},"readme":"through2-map\n============\n\n[![NPM](https://nodei.co/npm/through2-map.png)](https://nodei.co/npm/through2-map/)\n\nThis is a super thin wrapper around [through2](http://npm.im/through2) that works like `Array.prototype.map` but for streams.\n\nFor when through2 is just too verbose :wink:\n\nNote you will **NOT** be able to skip chunks. This is intended for modification only. If you want filter the stream content, use either `through2` or `through2-filter`. This transform also does not have a `flush` function.\n\n**IMPORTANT:** If you return `null` from your function, the stream will end there.\n\n```js\n\nvar map = require(\"through2-map\")\n\nvar truncate = map(function (chunk) {\n  return chunk.slice(0, 10)\n})\n\n// vs. with through2:\nvar truncate = through2(function (chunk, encoding, callback) {\n  this.push(chunk.slice(0, 10))\n  return callback()\n})\n\n// Then use your map:\nsource.pipe(truncate).pipe(sink)\n\n// Additionally accepts `wantStrings` argument to convert buffers into strings\nvar stripTags = map({wantStrings: true}, function (str) {\n  // OMG don't actually use this\n  return str.replace(/<.*?>/g, \"\")\n})\n\n// Works like `Array.prototype.map` meaning you can specify a function that\n// takes up to two* arguments: fn(chunk, index)\nvar spaceout = map({wantStrings: true}, function (chunk, index) {\n  return (index % 2 == 0) ? chunk + \"\\n\\n\" : chunk\n})\n\n// vs. with through2:\nvar spaceout = through2(function (chunk, encoding, callback) {\n  if (this.index == undefined) this.index = 0\n  var buf = (this.index++ % 2 == 0) ? Buffer.concat(chunk, new Buffer(\"\\n\\n\")) : chunk\n  this.push(buf)\n  return callback()\n})\n\n```\n\n*Differences from `Array.prototype.map`:\n  * Cannot insert `null` elements into the stream without aborting.\n  * No third `array` callback argument. That would require realizing the entire stream, which is generally counter-productive to stream operations.\n  * `Array.prototype.map` doesn't modify the source Array, which is somewhat nonsensical when applied to streams.\n\nAPI\n---\n\n```\nrequire(\"through2-map\")([options,] fn)\n```\n\nCreate a `stream.Transform` instance that will call `fn(chunk, index)` on each stream segment.\n\n- - -\n\n```\nvar Tx = require(\"through2-map\").ctor([options,] fn)\n```\n\nCreate a reusable `stream.Transform` TYPE that can be called via `new Tx` or `Tx()` to create an instance.\n\n- - -\n\n```\nrequire(\"through2-map\").obj([options,] fn)\n```\n\nCreate a `through2-map` instance that defaults to `objectMode: true`.\n\n- - -\n\n```\nrequire(\"through2-map\").objCtor([options,] fn)\n```\n\nJust like ctor, but with `objectMode: true` defaulting to true.\n\nOptions\n-------\n\n  * wantStrings: Automatically call chunk.toString() for the super lazy.\n  * all other through2 options\n\nLICENSE\n=======\n\nMIT\n","_attachments":{},"homepage":"https://github.com/brycebaril/through2-map#readme","bugs":{"url":"https://github.com/brycebaril/through2-map/issues"},"license":"MIT"}