{"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":{"integrity":"sha512-jaRjI2WxN3W1V8/FMZ9HKIBXixtiqs3SQSX4/YGIiP3gL6djW48VoZq9tDqeCWs3MT8YY5wb/zli8VW8snY1CA==","shasum":"700e786df2367c2c88cd8aa5be4cf9c1e7831254","tarball":"http://registry-npm.ywwl.com/through2-filter/download/through2-filter-3.0.0.tgz","fileCount":4,"unpackedSize":5520,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbLDQhCRA9TVsSAnZWagAAAYkQAIjIPNniVA8zuZh2NikQ\nsc7ic0FXc+fiH6fh4p3I1i0jTdcLagSSxApYqADPzyhHz7DIZD+pcwm6eH/F\n9o99Hytq8Yo0gm0rbk1hv65A5Gket/G8+OEbECVg+gQ2KDX12hEWJ6vxfp/o\nbT4pmawgE/Aof+nxC3swy0KixQv210B6sf5JD0SUZDOah92DqgZigZkXzQTP\nQcTSG9tuw2+5EGCcXy6aL0jhQlNd2xg3M1Hl8d++ViO38vp+LMmd70sqcNEB\ncXp2v1wRDOtKzqCHb24MaJioRhiz8LZkzg2kW6OiPy4ImPnMuV5ZAXf3h48a\nTmsJP9ilbJAke5qkjF6N2H7msahd/hKIFnoy8e09hyS+38J0H97WW8TBafLj\ncurM+zzCrFaTzspulypFtubVMfjKqwVfFb4Tf7rdv8FFEPjMZ4jYl0bPodwL\nEft5TBdNAIRNF6Y5orXE6EdMKDeKcZ97wJi9KMH39ZvTKAU+fN990x/JLowN\n8S4JA9w6DiS5IWCLZ0wUHk1VuXI83YDNX6HcjU3YkVQrxOixoCGPwanaeENN\naUDTCVgd0B/YsPfdKzOzNHyxtotM88lysw+75+D5T/mdNPA3+wtTzjiJ72ji\n6EisMehkoLC4USrFFrD7KKmwWdih7ZmNyRrB6gfI7NWgIqGJytH/MDgMLqMj\nMXt0\r\n=1iSt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCJexiSsRm/ML4z4Oxk5qwtuYHLtsZCLka2jPlKgti5dAIgbkCJU3WdqXBqBCnPhpURkRxnDIgUyY24JQrWQjX0Bww="}],"size":2509,"noattachment":false,"key":"/through2-filter/-/through2-filter-3.0.0.tgz"},"maintainers":[{"name":"bryce","email":"bryce@ravenwall.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/through2-filter_3.0.0_1529623585283_0.7524465934672058"},"_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","publish_time":1529623585383,"_cnpm_publish_time":1529623585383,"dist-tags":{"latest":"4.0.0"}}