From 22a5e5854b64e769549bc8ed388eb684d950d0a6 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sun, 5 Jun 2011 18:09:51 -0700 Subject: [PATCH] minor changes to cmp functions, more consistent now --- lib/object.js | 4 ++-- lib/string.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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; }