Skip to content

Commit

Permalink
properly compare strings.. duh
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenhandley committed May 31, 2012
1 parent 5eb8a8e commit 7fc2d3e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,20 @@

if (arguments.length === 1) {
var files = fs.readdirSync(dir);
files.sort(function(a,b) { return a.toLowerCase() - b.toLowerCase() });

files.sort(function(a,b) {
a = a.toLowerCase();
b = b.toLowerCase();

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

files.forEach(function(filename) {

if ((filename === 'index.js') || (filename[0] === '_')) { return; }
Expand Down

0 comments on commit 7fc2d3e

Please sign in to comment.