Skip to content

Instantly share code, notes, and snippets.

@dhyegocalota
Created July 8, 2016 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dhyegocalota/2f3ea2d5b4d2f1e55e2a1a0557d82a78 to your computer and use it in GitHub Desktop.
Save dhyegocalota/2f3ea2d5b4d2f1e55e2a1a0557d82a78 to your computer and use it in GitHub Desktop.
Unique Words (by line)
const fs = require('fs');
var data = [];
var file = fs.readFileSync(process.argv[2], {encoding: 'utf-8'});
file
.split('\n')
.forEach(x => {
if (data.indexOf(x) === -1) {
data.push(x);
}
});
console.log(data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment