I've been working with this library to implement a reorderable interface, and ran into a point of confusion.
As someone who's worked with JS a while, I avoid the default .sort() method by default, since it commonly gives incorrect results when sorting strings. My default inclination is to do something like the following:
I've been working with this library to implement a reorderable interface, and ran into a point of confusion.
As someone who's worked with JS a while, I avoid the default
.sort()
method by default, since it commonly gives incorrect results when sorting strings. My default inclination is to do something like the following:Using
localeCompare
caused my sort order to be incorrect, which resulted in a separatereorder
method throwing errors when callinggenerateKeyBetween
.I saw from #19 that the preferred method is
.sort()
, or I suppose a re-implementation of the default sort algorithm, like so:It might be nice to document that in the readme somewhere, so others don't run into the same issue.