node-buffertools icon indicating copy to clipboard operation
node-buffertools copied to clipboard

Compare obey lexicographical order

Open dfoody opened this issue 13 years ago • 1 comments

I suppose this is not technically a bug, but it would be great to have compare act more like a standard comparison algorithm so that buffers can be sorted "properly". That is, sorting buffers containing ascii text should sort the same way as sorting the same text lexicographically.

So, if you have the following buffers with the following bytes: A: 00 00 00 00 (length 4) B: ff ff (length 2) C: ff ff 00 (length 3) D: ff ff 01 (length 3)

They should sort as A, B, C, D. The current compare algorithm would cause them to be sorted as B, C, D, A.

dfoody avatar Feb 20 '12 21:02 dfoody

Not unreasonable. Want to try your hand at a patch?

bnoordhuis avatar Feb 20 '12 21:02 bnoordhuis