overset / javascript-natural-sort

Sort things "naturally" in Javascript
MIT License
132 stars 62 forks source link

Sorting incorrect when there is a space #16

Closed 0xadri closed 9 years ago

0xadri commented 10 years ago

var stringAlphanumericalOne = [' ','1','a']; var stringAlphanumericalTwo = ['img ','img1','imga', 'imgz']; var stringAlphanumericalThree = ['img 99','img199','imga99', 'imgz99'];

console.log( stringAlphanumericalOne.sort(naturalSort) ); console.log( stringAlphanumericalTwo.sort(naturalSort) ); /* in the call below it fails! order should be ["img 99", "img199", "imga99", "imgz99"] */ console.log( stringAlphanumericalThree.sort(naturalSort) );

see the live demo on http://jsbin.com/hihoqulediyi/1/edit?js,console

0xadri commented 10 years ago

I did some further research regarding this topic, see the result on https://github.com/javve/natural-sort/issues/7

overset commented 9 years ago

fixed with eaee858