Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Sort errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hcodes committed Apr 9, 2015
1 parent 5395f3a commit fd570b1
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lib/report/error_dictionary.js
@@ -1,5 +1,6 @@
var fs = require('fs'),
chalk = require('chalk');
chalk = require('chalk'),
_ = require('lodash');

module.exports = {
onend: function(data) {
Expand All @@ -17,6 +18,20 @@ module.exports = {
});
}
});

buffer = _.uniq(buffer).sort(function(a, b) {
a = a.toLowerCase();
b = b.toLowerCase();

if(a > b) {
return 1;
} else if(a === b) {
return 0;
} else {
return -1;
}
});

try {
fs.writeFileSync(filename, JSON.stringify(buffer, null, ' '));
console.log(chalk.cyan('JSON dictionary with typos: ./' + filename));
Expand Down

0 comments on commit fd570b1

Please sign in to comment.