mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Cleanup compareAscending.
Former-commit-id: c11be9f8211242a8d25a2cd06e20efefa685c3ee
This commit is contained in:
19
lodash.js
19
lodash.js
@@ -757,18 +757,17 @@
|
||||
a = a.criteria;
|
||||
b = b.criteria;
|
||||
|
||||
if (a === b) {
|
||||
return ai < bi ? -1 : 1;
|
||||
}
|
||||
if (a === undefined) {
|
||||
return 1;
|
||||
}
|
||||
if (b === undefined) {
|
||||
return -1;
|
||||
}
|
||||
// ensure a stable sort in V8 and other engines
|
||||
// http://code.google.com/p/v8/issues/detail?id=90
|
||||
return a < b ? -1 : a > b ? 1 : ai < bi ? -1 : 1;
|
||||
if (a !== b) {
|
||||
if (a > b || a === undefined) {
|
||||
return 1;
|
||||
}
|
||||
if (a < b || b === undefined) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return ai < bi ? -1 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user