Skip to content

Instantly share code, notes, and snippets.

@sujith3g
Created August 1, 2015 20:06
Show Gist options
  • Save sujith3g/70a49e4ae2ca18e4153f to your computer and use it in GitHub Desktop.
Save sujith3g/70a49e4ae2ca18e4153f to your computer and use it in GitHub Desktop.
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', start);
function start(chunk){
var chunks = chunk.toString().split('\n');
// maxcount = chunks.shift();
chunks = chunks.filter(function(e){return e});
for (var i=0; i < chunks.length; i++ ){
if(chunks[i] === "42") break;
console.log(chunks[i]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment