{"_id":"through2-filter","_rev":"4132939","name":"through2-filter","description":"A through2 to create an Array.prototype.filter analog for streams.","dist-tags":{"latest":"4.0.0"},"maintainers":[{"name":"bryce","email":""}],"time":{"modified":"2026-03-01T18:40:56.000Z","created":"2013-08-06T04:45:44.809Z","4.0.0":"2024-04-20T17:44:59.803Z","3.1.0":"2024-04-12T18:37:52.678Z","3.0.0":"2018-06-21T23:26:25.383Z","2.0.0":"2015-06-17T06:37:37.526Z","1.4.1":"2015-01-25T23:49:27.127Z","1.4.0":"2014-06-20T22:34:51.740Z","1.3.1":"2014-01-31T01:01:29.037Z","1.3.0":"2013-09-23T03:05:37.976Z","1.2.0":"2013-09-20T17:48:17.229Z","1.1.0":"2013-08-07T06:32:46.955Z","1.0.2":"2013-08-06T05:17:02.534Z","1.0.1":"2013-08-06T05:15:46.025Z","1.0.0":"2013-08-06T04:45:44.809Z"},"users":{"9joneg":true,"bret":true,"mrmlnc":true,"mrzmmr":true,"kiinlam":true},"author":{"name":"Bryce B. Baril"},"repository":{"type":"git","url":"git+ssh://git@github.com/brycebaril/through2-filter.git"},"versions":{"4.0.0":{"name":"through2-filter","version":"4.0.0","description":"A through2 to create an Array.prototype.filter analog for streams.","directories":{"test":"test"},"scripts":{"test":"node test/"},"repository":{"type":"git","url":"git+ssh://git@github.com/brycebaril/through2-filter.git"},"keywords":["streams","through","through2","filter"],"author":{"name":"Bryce B. Baril"},"license":"MIT","jshintConfig":{"asi":true,"globalstrict":true,"validthis":true,"eqnull":true,"node":true,"loopfunc":true,"newcap":false,"eqeqeq":false},"bugs":{"url":"https://github.com/brycebaril/through2-filter/issues"},"engines":{"node":">= 6"},"devDependencies":{"concat-stream":"^2.0.0","stream-spigot":"^3.0.5","tape":"^4.0.0"},"dependencies":{"through2":"^4.0.2"},"_id":"through2-filter@4.0.0","gitHead":"9db344094b3018cfcc5e74a44b86d85d40393ac1","homepage":"https://github.com/brycebaril/through2-filter#readme","_nodeVersion":"20.11.1","_npmVersion":"10.2.4","dist":{"shasum":"1cdaa1276d4ee87f926e83f565a4332d6a2adfd7","size":2492,"noattachment":false,"key":"/through2-filter/-/through2-filter-4.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-filter/download/through2-filter-4.0.0.tgz"},"_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/through2-filter_4.0.0_1713635099621_0.44398728615500604"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-04-20T17:44:59.803Z","publish_time":1713635099803,"_source_registry_name":"default","_cnpm_publish_time":1713635099803},"3.1.0":{"name":"through2-filter","version":"3.1.0","description":"A through2 to create an Array.prototype.filter analog for streams.","directories":{"test":"test"},"scripts":{"test":"node test/"},"repository":{"type":"git","url":"git+ssh://git@github.com/brycebaril/through2-filter.git"},"keywords":["streams","through","through2","filter"],"author":{"name":"Bryce B. Baril"},"license":"MIT","jshintConfig":{"asi":true,"globalstrict":true,"validthis":true,"eqnull":true,"node":true,"loopfunc":true,"newcap":false,"eqeqeq":false},"bugs":{"url":"https://github.com/brycebaril/through2-filter/issues"},"engines":{"node":">= 6"},"devDependencies":{"concat-stream":"^2.0.0","stream-spigot":"^3.0.5","tape":"^4.0.0"},"dependencies":{"through2":"^4.0.2"},"_id":"through2-filter@3.1.0","gitHead":"efd90bd73fa0bb1bbef74951bfff9c5b80c94f62","homepage":"https://github.com/brycebaril/through2-filter#readme","_nodeVersion":"20.11.1","_npmVersion":"10.2.4","dist":{"shasum":"4a1b45d2b76b3ac93ec137951e372c268efc1a4e","size":2494,"noattachment":false,"key":"/through2-filter/-/through2-filter-3.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-filter/download/through2-filter-3.1.0.tgz"},"_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/through2-filter_3.1.0_1712947072510_0.9219762057879717"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-04-12T18:37:52.678Z","publish_time":1712947072678,"_source_registry_name":"default","deprecated":"this package has been deprecated for breaking semver major","_cnpm_publish_time":1712947072678},"3.0.0":{"name":"through2-filter","version":"3.0.0","description":"A through2 to create an Array.prototype.filter analog for streams.","files":["index.js"],"directories":{"test":"test"},"scripts":{"test":"node test/"},"repository":{"type":"git","url":"git+ssh://git@github.com/brycebaril/through2-filter.git"},"keywords":["streams","through","through2","filter"],"author":{"name":"Bryce B. Baril"},"license":"MIT","jshintConfig":{"asi":true,"globalstrict":true,"validthis":true,"eqnull":true,"node":true,"loopfunc":true,"newcap":false,"eqeqeq":false},"bugs":{"url":"https://github.com/brycebaril/through2-filter/issues"},"devDependencies":{"tape":"^4.0.0","stream-spigot":"^3.0.5","concat-stream":"^1.4.7"},"dependencies":{"through2":"~2.0.0","xtend":"~4.0.0"},"gitHead":"6b5f6684a420a3029e5258737caef1276d53a1dc","homepage":"https://github.com/brycebaril/through2-filter#readme","_id":"through2-filter@3.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"dist":{"shasum":"700e786df2367c2c88cd8aa5be4cf9c1e7831254","size":2509,"noattachment":false,"key":"/through2-filter/-/through2-filter-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-filter/download/through2-filter-3.0.0.tgz"},"maintainers":[{"name":"bryce","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/through2-filter_3.0.0_1529623585283_0.7524465934672058"},"_hasShrinkwrap":false,"publish_time":1529623585383,"_cnpm_publish_time":1529623585383},"2.0.0":{"name":"through2-filter","version":"2.0.0","description":"A through2 to create an Array.prototype.filter analog for streams.","files":["index.js"],"directories":{"test":"test"},"scripts":{"test":"node test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-filter.git"},"keywords":["streams","through","through2","filter"],"author":{"name":"Bryce B. Baril"},"license":"MIT","jshintConfig":{"asi":true,"globalstrict":true,"validthis":true,"eqnull":true,"node":true,"loopfunc":true,"newcap":false,"eqeqeq":false},"bugs":{"url":"https://github.com/brycebaril/through2-filter/issues"},"devDependencies":{"tape":"^4.0.0","stream-spigot":"^3.0.5","concat-stream":"^1.4.7"},"dependencies":{"through2":"~2.0.0","xtend":"~4.0.0"},"gitHead":"fd290780ed8f8a9e9452c947e7f8cd9f8fefba72","homepage":"https://github.com/brycebaril/through2-filter","_id":"through2-filter@2.0.0","_shasum":"60bc55a0dacb76085db1f9dae99ab43f83d622ec","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"dist":{"shasum":"60bc55a0dacb76085db1f9dae99ab43f83d622ec","size":1816,"noattachment":false,"key":"/through2-filter/-/through2-filter-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-filter/download/through2-filter-2.0.0.tgz"},"publish_time":1434523057526,"_cnpm_publish_time":1434523057526,"_hasShrinkwrap":false},"1.4.1":{"name":"through2-filter","version":"1.4.1","description":"A through2 to create an Array.prototype.filter analog for streams.","files":["index.js"],"directories":{"test":"test"},"scripts":{"test":"node test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-filter.git"},"keywords":["streams","through","through2","filter"],"author":{"name":"Bryce B. Baril"},"license":"MIT","jshintConfig":{"asi":true,"globalstrict":true,"validthis":true,"eqnull":true,"node":true,"loopfunc":true,"newcap":false,"eqeqeq":false},"bugs":{"url":"https://github.com/brycebaril/through2-filter/issues"},"devDependencies":{"tape":"^3.4.0","stream-spigot":"^3.0.5","concat-stream":"^1.4.7"},"dependencies":{"through2":"~0.6.3","xtend":"~4.0.0"},"gitHead":"1c45deaa4e9f4612e97ed7b27ec6d8cf659acb97","homepage":"https://github.com/brycebaril/through2-filter","_id":"through2-filter@1.4.1","_shasum":"b6d417dcd9d67a3a1e3d3b600f5e92b6350ae397","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"dist":{"shasum":"b6d417dcd9d67a3a1e3d3b600f5e92b6350ae397","size":1874,"noattachment":false,"key":"/through2-filter/-/through2-filter-1.4.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-filter/download/through2-filter-1.4.1.tgz"},"publish_time":1422229767127,"_cnpm_publish_time":1422229767127,"_hasShrinkwrap":false},"1.4.0":{"name":"through2-filter","version":"1.4.0","description":"A through2 to create an Array.prototype.filter analog for streams.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"node test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-filter.git"},"keywords":["streams","through","through2","filter"],"author":{"name":"Bryce B. Baril"},"license":"MIT","jshintConfig":{"asi":true,"globalstrict":true,"validthis":true,"eqnull":true,"node":true,"loopfunc":true,"newcap":false,"eqeqeq":false},"bugs":{"url":"https://github.com/brycebaril/through2-filter/issues"},"devDependencies":{"tape":"~2.13.3","stream-spigot":"~3.0.4","concat-stream":"~1.4.6"},"dependencies":{"through2":"~0.5.1","xtend":"~3.0.0"},"homepage":"https://github.com/brycebaril/through2-filter","_id":"through2-filter@1.4.0","_shasum":"603fb7f662385e51ef1057faa2ac0a014f54871f","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"dist":{"shasum":"603fb7f662385e51ef1057faa2ac0a014f54871f","size":3185,"noattachment":false,"key":"/through2-filter/-/through2-filter-1.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-filter/download/through2-filter-1.4.0.tgz"},"publish_time":1403303691740,"_cnpm_publish_time":1403303691740,"_hasShrinkwrap":false},"1.3.1":{"name":"through2-filter","version":"1.3.1","description":"A through2 to create an Array.prototype.filter analog for streams.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"node test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-filter.git"},"keywords":["streams","through","through2","filter"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-filter/issues"},"devDependencies":{"tape":"~2.4.0","stream-spigot":"~3.0.3","concat-stream":"~1.4.1"},"dependencies":{"through2":"~0.4.1"},"homepage":"https://github.com/brycebaril/through2-filter","_id":"through2-filter@1.3.1","dist":{"shasum":"e0c4c853eba4056441821cfac298e3af9d1d693a","size":2791,"noattachment":false,"key":"/through2-filter/-/through2-filter-1.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-filter/download/through2-filter-1.3.1.tgz"},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1391130089037,"_cnpm_publish_time":1391130089037,"_hasShrinkwrap":false},"1.3.0":{"name":"through2-filter","version":"1.3.0","description":"A through2 to create an Array.prototype.filter analog for streams.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"node test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-filter.git"},"keywords":["streams","through","through2","filter"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-filter/issues"},"devDependencies":{"tape":"~1.1.1","stream-spigot":"~2.1.2","concat-stream":"~1.0.0"},"dependencies":{"through2":"~0.2.2"},"readmeFilename":"README.md","_id":"through2-filter@1.3.0","dist":{"shasum":"ff01945ee6a0ebfee09023b05e6917542bae7fae","size":2810,"noattachment":false,"key":"/through2-filter/-/through2-filter-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-filter/download/through2-filter-1.3.0.tgz"},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1379905537976,"_cnpm_publish_time":1379905537976,"_hasShrinkwrap":false},"1.2.0":{"name":"through2-filter","version":"1.2.0","description":"A through2 to create an Array.prototype.filter analog for streams.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"tap test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-filter.git"},"keywords":["streams","through","through2","filter"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-filter/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-filter@1.2.0","dist":{"shasum":"0e58b2afabd981be400c6ebdedc80500e618b27c","size":2780,"noattachment":false,"key":"/through2-filter/-/through2-filter-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-filter/download/through2-filter-1.2.0.tgz"},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1379699297229,"_cnpm_publish_time":1379699297229,"_hasShrinkwrap":false},"1.1.0":{"name":"through2-filter","version":"1.1.0","description":"A through2 to create an Array.prototype.filter analog for streams.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"tap test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-filter.git"},"keywords":["streams","through","through2","filter"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-filter/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-filter@1.1.0","dist":{"shasum":"5a113fc688daf885dc69ae41bd439e8bcebc86ed","size":2773,"noattachment":false,"key":"/through2-filter/-/through2-filter-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-filter/download/through2-filter-1.1.0.tgz"},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1375857166955,"_cnpm_publish_time":1375857166955,"_hasShrinkwrap":false},"1.0.2":{"name":"through2-filter","version":"1.0.2","description":"A through2 to create an Array.prototype.filter analog for streams.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"tap test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-filter.git"},"keywords":["streams","through","through2","filter"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-filter/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-filter@1.0.2","dist":{"shasum":"2cdc698c7db0e5ffb03673146401452f0af4c403","size":2719,"noattachment":false,"key":"/through2-filter/-/through2-filter-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-filter/download/through2-filter-1.0.2.tgz"},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1375766222534,"_cnpm_publish_time":1375766222534,"_hasShrinkwrap":false},"1.0.1":{"name":"through2-filter","version":"1.0.1","description":"A through2 to create an Array.prototype.filter analog for streams.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"tap test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-filter.git"},"keywords":["streams","through","through2","filter"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-filter/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-filter@1.0.1","dist":{"shasum":"2979fe07ae61fbbf9cbc17f5f94c6b1ae9580adb","size":2718,"noattachment":false,"key":"/through2-filter/-/through2-filter-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-filter/download/through2-filter-1.0.1.tgz"},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1375766146025,"_cnpm_publish_time":1375766146025,"_hasShrinkwrap":false},"1.0.0":{"name":"through2-filter","version":"1.0.0","description":"A through2 to create an Array.prototype.filter analog for streams.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"tap test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-filter.git"},"keywords":["streams","through","through2","filter"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-filter/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-filter@1.0.0","dist":{"shasum":"4bddbd08087c004f1ed5d9d6289d9a19d87c9ee6","size":2689,"noattachment":false,"key":"/through2-filter/-/through2-filter-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/through2-filter/download/through2-filter-1.0.0.tgz"},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1375764344809,"_cnpm_publish_time":1375764344809,"_hasShrinkwrap":false}},"readme":"through2-filter\n===============\n\n[![NPM](https://nodei.co/npm/through2-filter.png)](https://nodei.co/npm/through2-filter/)\n\nThis is a super thin wrapper around [through2](http://npm.im/through2) that works like `Array.prototype.filter` but for streams.\n\nFor when through2 is just too verbose :wink:\n\nNote you will **NOT** be able to alter the content of the chunks. This is intended for filtering only. If you want to modify the stream content, use either `through2` or `through2-map`.\n\n```js\nvar filter = require(\"through2-filter\")\n\nvar skip = filter(function (chunk) {\n  // skip buffers longer than 100\n  return chunk.length < 100\n})\n\n// vs. with through2:\nvar skip = through2(function (chunk, encoding, callback) {\n  // skip buffers longer than 100\n  if (chunk.length < 100) this.push(chunk)\n  return callback()\n})\n\n// Then use your filter:\nsource.pipe(skip).pipe(sink)\n\n// Additionally accepts `wantStrings` argument to conver buffers into strings\nvar alphanum = new RegExp(\"^[A-Za-z0-1]+$\")\nvar scrub = filter({wantStrings: true}, function (str) {\n  return alphanum.exec(str)\n})\n\n// Works like `Array.prototype.filter` meaning you can specify a function that\n// takes up to two* arguments: fn(element, index)\nvar skip10 = filter(function (element, index) {\n  return index > 10\n})\n```\n\n*Differences from `Array.prototype.filter`:\n  * No third `array` callback argument. That would require realizing the entire stream, which is generally counter-productive to stream operations.\n  * `Array.prototype.filter` doesn't modify the source Array, which is somewhat nonsensical when applied to streams.\n\nAPI\n---\n\n`require(\"through2-filter\")([options], fn)`\n---\n\nCreate a `through2-filter` instance that will call `fn(chunk)`. If `fn(chunk)` returns \"true\" the chunk will be passed downstream. Otherwise it will be dropped.\n\n`require(\"through2-filter\").ctor([options], fn)`\n---\n\nCreate a `through2-filter` Type that can be instantiated via `new Type()` or `Type()` to create reusable spies.\n\n`require(\"through2-filter\").obj([options], fn)`\n---\n\nCreate a `through2-filter` that defaults to `objectMode = true`.\n\n`require(\"through2-filter\").objCtor([options], fn)`\n---\n\nCreate a `through2-filter` Type that defaults to `objectMode = 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-filter#readme","bugs":{"url":"https://github.com/brycebaril/through2-filter/issues"},"license":"MIT"}