mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Ensure _.sortBy is stable for undefined values.
Former-commit-id: bf250150d27de050ea7a6fa376aacdc8d1ba7716
This commit is contained in:
@@ -757,6 +757,9 @@
|
||||
a = a.criteria;
|
||||
b = b.criteria;
|
||||
|
||||
if (a === b) {
|
||||
return ai < bi ? -1 : 1;
|
||||
}
|
||||
if (a === undefined) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1340,7 +1340,10 @@
|
||||
new Pair(1, 5), new Pair(1, 6),
|
||||
new Pair(2, 1), new Pair(2, 2),
|
||||
new Pair(2, 3), new Pair(2, 4),
|
||||
new Pair(2, 5), new Pair(2, 6)
|
||||
new Pair(2, 5), new Pair(2, 6),
|
||||
new Pair(undefined, 1), new Pair(undefined, 2),
|
||||
new Pair(undefined, 3), new Pair(undefined, 4),
|
||||
new Pair(undefined, 5), new Pair(undefined, 6)
|
||||
];
|
||||
|
||||
var actual = _.sortBy(collection, function(pair) {
|
||||
|
||||
Reference in New Issue
Block a user