文件名称:stream-switch:开关柜的流条件
文件大小:31KB
文件格式:ZIP
更新时间:2024-07-27 09:08:46
JavaScript
流切换 switch/case 的流条件,就像 if/else 的 安装 $ npm install stream-switch -g 用法 var switchStream = require('stream-switch'); process.in .pipe(switchStream(function(buf) { if (buf > 0) { return 'case1'; } else if (buf < 0) { return 'case2' } }, { 'case1': streamA, 'case2': streamB })) .pipe(process.stdout) 如果 buf 大于 0,则通过管道传输到 streamA。 如果 buf 小于 0,则通过管道传输到 streamB。 否则 buf 等于 0,管道直接输出。 应
【文件预览】:
stream-switch-master
----.jshintrc(546B)
----img()
--------switch.png(29KB)
----.npmignore(83B)
----.travis.yml(70B)
----test()
--------index.js(3KB)
----HISTORY.md(40B)
----README.md(1KB)
----Makefile(250B)
----.editorconfig(245B)
----.gitignore(22B)
----index.js(1KB)
----package.json(687B)