Skip to content

Commit

Permalink
import lib
Browse files Browse the repository at this point in the history
  • Loading branch information
logicalparadox committed Nov 19, 2012
1 parent a1fd10d commit dddbfdc
Show file tree
Hide file tree
Showing 2 changed files with 580 additions and 1 deletion.
23 changes: 23 additions & 0 deletions lib/comparators.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
exports.ASC = function (a, b) {
return a.value - b.value;
};

exports.DESC = function (a, b) {
return b.value - a.value;
};

exports.KASC = function (a, b) {
var A = a.key.toLowerCase()
, B = b.key.toLowerCase();
if (A < B) return -1;
else if (A > B) return 1;
else return 0;
};

exports.KDESC = function (a, b) {
var A = a.key.toLowerCase()
, B = b.key.toLowerCase();
if (A < B) return 1;
else if (A > B) return -1;
else return 0;
};
Loading

0 comments on commit dddbfdc

Please sign in to comment.