mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
Make _.sortBy moveundefined and NaN to the end of the array.
This commit is contained in:
@@ -331,10 +331,13 @@
|
|||||||
*/
|
*/
|
||||||
function baseCompareAscending(value, other) {
|
function baseCompareAscending(value, other) {
|
||||||
if (value !== other) {
|
if (value !== other) {
|
||||||
if (value > other || typeof value == 'undefined') {
|
var valIsReflexive = value === value,
|
||||||
|
othIsReflexive = other === other;
|
||||||
|
|
||||||
|
if (value > other || !valIsReflexive || (typeof value == 'undefined' && othIsReflexive)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (value < other || typeof other == 'undefined') {
|
if (value < other || !othIsReflexive || (typeof other == 'undefined' && valIsReflexive)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user