diff --git a/lib/object.js b/lib/object.js index adfc2b0..3f5f999 100644 --- a/lib/object.js +++ b/lib/object.js @@ -14,9 +14,9 @@ exports.extendNative = function() { extend(module.exports, ObjectExt); function cmp(a, b) { - if (a === b) return 0; - if (a < b) return -1; if (a > b) return 1; + if (a < b) return -1; + if (a === b) return 0; throw new Error('cannot effectively compare values'); } diff --git a/lib/string.js b/lib/string.js index 5aba58b..47fa4af 100644 --- a/lib/string.js +++ b/lib/string.js @@ -15,7 +15,7 @@ exports.extendNative = function() { require('./object').extend(exports, StringExt); function cmp(a, b) { - if (a === b) return 0; + if (a > b) return 1; if (a < b) return -1; - return 1; // a > b + return 0; }