Skip to content

Commit 099c9a5

Browse files
committed
Stabilize mergesort
1 parent 3f1e662 commit 099c9a5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Data/Array.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ exports.sortByImpl = (function () {
290290
while (i < mid && j < to) {
291291
x = xs2[i];
292292
y = xs2[j];
293-
c = fromOrdering(compare(x)(y));
293+
c = fromOrdering(compare(x)(y)) || i - j;
294294
if (c > 0) {
295295
xs1[k++] = y;
296296
++j;

0 commit comments

Comments
 (0)