mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Allow sortBy to handle undefined values.
This commit is contained in:
@@ -270,6 +270,8 @@
|
||||
};
|
||||
}).sort(function(left, right) {
|
||||
var a = left.criteria, b = right.criteria;
|
||||
if (_.isUndefined(a)) return 1;
|
||||
if (_.isUndefined(b)) return -1;
|
||||
return a < b ? -1 : a > b ? 1 : 0;
|
||||
}), 'value');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user