A comparator function for Array.sort should return:
a value less than zero if a is less than b
zero if a is equal to b
a value greater than zero if a is greater than b
The previous implementation of the comparator function (introduced in #95) could only ever return true/false, i.e. 1/0 but no -1. So, what I think happened was that when 0 was returned, Node attempted to apply a default ordering on the objects based on the values of all their properties. That is why a seemingly innocuous change such as changing an lts property from false to true resulted in a broken order. I guess the order was previously correct only by accident 😄
A comparator function for
Array.sort
should return:a
is less thanb
a
is equal tob
a
is greater thanb
The previous implementation of the comparator function (introduced in #95) could only ever return true/false, i.e. 1/0 but no -1. So, what I think happened was that when 0 was returned, Node attempted to apply a default ordering on the objects based on the values of all their properties. That is why a seemingly innocuous change such as changing an
lts
property fromfalse
totrue
resulted in a broken order. I guess the order was previously correct only by accident 😄