{"_id":"stream-switch","_rev":"7-ce28f52b4976aed9176ae692502c8c32","name":"stream-switch","description":"Stream condition for switch/case","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"stream-switch","version":"0.1.0","description":"Stream condition for switch/case","main":"index","dependencies":{"duplexer2":"~0.0.2","through2":"~0.5.1"},"devDependencies":{"coveralls":"2","istanbul":"0","mocha":"1","should":"4"},"repository":{"type":"git","url":"https://github.com/popomore/stream-switch"},"keyword":["stream","switch","case","condition","gulp"],"homepage":"https://github.com/popomore/stream-switch","author":{"name":"popomore","email":"sakura9515@gmail.com"},"license":"MIT","scripts":{"test":"make test"},"bugs":{"url":"https://github.com/popomore/stream-switch/issues"},"_id":"stream-switch@0.1.0","dist":{"shasum":"f094ce99163143339df9f18170e72b319426a04b","tarball":"https://registry.npmjs.org/stream-switch/-/stream-switch-0.1.0.tgz","integrity":"sha512-iXWHCbW+mVjGhWx3vv8GBfR8oaAROKd620P7xR58iKDBB5Oe2bPvWW/6UJT9wzgGYqVx/lRZP6vygMvdB91h/g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCzYccjD4LUl/8eLyUN8v7X4K8SdnucVKoYqz8z7e0a2AIgG5a78ymU8Ir9jDUKrTkt5wIpn2CYdic9DBF/Wrye/X8="}]},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"popomore","email":"sakura9515@gmail.com"},"maintainers":[{"name":"popomore","email":"sakura9515@gmail.com"}]},"0.1.1":{"name":"stream-switch","version":"0.1.1","description":"Stream condition for switch/case","main":"index","dependencies":{"duplexer2":"~0.0.2","through2":"~0.5.1","pedding":"~1.0.0"},"devDependencies":{"coveralls":"2","istanbul":"0","mocha":"1","should":"4"},"repository":{"type":"git","url":"https://github.com/popomore/stream-switch"},"keyword":["stream","switch","case","condition","gulp"],"homepage":"https://github.com/popomore/stream-switch","author":{"name":"popomore","email":"sakura9515@gmail.com"},"license":"MIT","scripts":{"test":"make test"},"bugs":{"url":"https://github.com/popomore/stream-switch/issues"},"_id":"stream-switch@0.1.1","dist":{"shasum":"1bc746a99a9e67e17ab93b394f0eb8b904d0d002","tarball":"https://registry.npmjs.org/stream-switch/-/stream-switch-0.1.1.tgz","integrity":"sha512-B9I1CxbompFYaJcITNWfOGZwXbZ3i1eE3k977W5IG89prvb6gjF/TV5epoa0b7d8L5A+dGkpvE3JVRP3+xzLAA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDOwyZ73exfOiAil0cZwefgb4e59FOsb0VzxWtf6Jyd6AIhAPvAniD0IU6FGVmqzZ8F+SUHM5X7Mi//U0BaW2uzCDi8"}]},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"popomore","email":"sakura9515@gmail.com"},"maintainers":[{"name":"popomore","email":"sakura9515@gmail.com"}]}},"readme":"# stream-switch [![Build Status](https://travis-ci.org/popomore/stream-switch.png?branch=master)](https://travis-ci.org/popomore/stream-switch) [![Coverage Status](https://coveralls.io/repos/popomore/stream-switch/badge.png?branch=master)](https://coveralls.io/r/popomore/stream-switch?branch=master) \n\nStream condition for switch/case, just like [ternary-stream](https://github.com/robrich/ternary-stream) for if/else\n\n---\n\n## Install\n\n```\n$ npm install stream-switch -g\n```\n\n## Usage\n\n![](https://raw.githubusercontent.com/popomore/stream-switch/master/img/switch.png)\n\n```\nvar switchStream = require('stream-switch');\n\nprocess.in\n.pipe(switchStream(function(buf) {\n  if (buf > 0) {\n    return 'case1';\n  } else if (buf < 0) {\n    return 'case2'\n  }\n}, {\n  'case1': streamA,\n  'case2': streamB\n}))\n.pipe(process.stdout)\n```\n\nIf buf great than 0, then pipe to streamA. If buf less than 0, then pipe to streamB. Otherwise buf equal to 0, pipe to output directly.\n\n## API\n\nswitchStream(switch, cases)\n\n#### switch\n\nSwitch condition determine which case will be choose.\n\nSwitch can be any type, if switch is function, it will be called.\n\n#### cases\n\nChoose which stream will be piped to by key switch return.\n\n## LISENCE\n\nCopyright (c) 2014 popomore. Licensed under the MIT license.\n","maintainers":[{"name":"popomore","email":"sakura9515@gmail.com"}],"time":{"modified":"2022-06-27T00:50:09.967Z","created":"2014-06-27T15:29:14.473Z","0.1.0":"2014-06-27T15:29:14.473Z","0.1.1":"2014-12-11T10:10:53.652Z"},"homepage":"https://github.com/popomore/stream-switch","repository":{"type":"git","url":"https://github.com/popomore/stream-switch"},"author":{"name":"popomore","email":"sakura9515@gmail.com"},"bugs":{"url":"https://github.com/popomore/stream-switch/issues"},"license":"MIT","readmeFilename":"README.md","users":{"lapanoid":true}}