Closed vmx closed 6 years ago
Looks good. Is it covered by any tests?
Yes, it was triggered by failing tests, examples are https://github.com/ipld/js-ipld/issues/172 and https://ci.ipfs.team/blue/organizations/jenkins/IPLD%2Fjs-ipld-ethereum/detail/PR-35/2/tests. Those now pass.
I take @achingbrain as an "approved", hence merge this change.
The sorting function was returning a boolean, which is wrong. For proper comparison it needs to return an integer.
Intrestingly enough, this issue only surfaced in the Browser test run on Windows. There somehow the sorting function of a two element array gets the second element first, then the second element.