Skip to content

Commit 27a4381

Browse files
committed
Cannot quite seem to satisfy the "should produce results that change the order of the list as little as possible" condition of sortBy. Otherwise, it works.
1 parent 938d2d3 commit 27a4381

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/underbar.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,10 +607,15 @@ var _ = {};
607607
});
608608

609609
iterated.sort(function(a, b) {
610+
/*
610611
if (a[1]===undefined) {
611612
return 1;
612613
} else {
613614
return a[1]-b[1];
615+
}*/
616+
if (a[1] !== b[1]) {
617+
if (a[1] > b[1] || a[1] === void 0) return 1;
618+
if (a[1] < b[1] || b[1] === void 0) return -1;
614619
}
615620
});
616621
_.each(iterated, function(val) {

0 commit comments

Comments
 (0)