What you're looking for already exists without modiyfing the node.js core code.
https://www.npmjs.org/package/event-stream On Monday, 18 August 2014 13:45:20 UTC+2, Ep Ga wrote: > > And I feel pipe would be so much better if it could except other function > that is not native to it but to the ECMAScript spec. I could have done this > vie pipe if it was design so. for example: > > [code] > ``` > "use strict"; > var num; > num = 1; > process.pipe(function(data){ > String(data).split(/\n/).forEach(function(arr){ > switch(num){ > case (0):{ > process.stdout.write(String(arr).toUpperCase()+"\n"); > break; > } > case (1):{ > process.stdout.write(String(arr).toLowerCase()+"\n"); > break; > } > } > if(num === 0){num = 1}else{num = 0} > }); > }); > ``` > [/code] > > This will make pipe more utilities wise, and easies to use. > > Here are two more example: > [code] > ``` > process.stdin.pipe(function(data){ > return (String(data).toUpperCase()); > }).pipe(process.stdout); > > process.stdin.pipe(function(data){ > return (String(data).toLowerCase()); > }).pipe(process.stdout); > > process.stdin.pipe(function(data){ > return ((data).split("\n")); > }).pipe(function(data){ > return (function(arr){ > (arr).forEach( > function(data){ > return (data.charAt[0] % 2 === 0 ? > data.toLowerCase() : > data.toUpperCase());}); > }).pipe(process.stdout); > ``` > [/code] > > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/7cc111b3-12e4-4c28-bbaf-1763369d4861%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
