mirror of
https://github.com/samsonjs/batteries.git
synced 2026-03-25 09:15:46 +00:00
minor changes to cmp functions, more consistent now
This commit is contained in:
parent
f956cefaab
commit
22a5e5854b
2 changed files with 4 additions and 4 deletions
|
|
@ -14,9 +14,9 @@ exports.extendNative = function() {
|
||||||
extend(module.exports, ObjectExt);
|
extend(module.exports, ObjectExt);
|
||||||
|
|
||||||
function cmp(a, b) {
|
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 -1;
|
||||||
|
if (a === b) return 0;
|
||||||
throw new Error('cannot effectively compare values');
|
throw new Error('cannot effectively compare values');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ exports.extendNative = function() {
|
||||||
require('./object').extend(exports, StringExt);
|
require('./object').extend(exports, StringExt);
|
||||||
|
|
||||||
function cmp(a, b) {
|
function cmp(a, b) {
|
||||||
if (a === b) return 0;
|
if (a > b) return 1;
|
||||||
if (a < b) return -1;
|
if (a < b) return -1;
|
||||||
return 1; // a > b
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue