mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +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) {
|
||||
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;
|
||||
}
|
||||
if (value < other || typeof other == 'undefined') {
|
||||
if (value < other || !othIsReflexive || (typeof other == 'undefined' && valIsReflexive)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user