Created
July 14, 2017 09:46
-
-
Save MelvinTo/79386f1e3850b9da28440b02c512aabf to your computer and use it in GitHub Desktop.
dedup words (streaming process from stdin)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var readline = require('readline'); | |
var rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout, | |
terminal: false | |
}); | |
let hash = {}; | |
rl.on('line', function(line){ | |
if(hash[line]) { | |
// skip | |
} else { | |
hash[line] = 1; | |
console.log(line); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment