johnnyshields / naturalsort

NaturalSort is a simple library which implements a natural, human-friendly alphanumeric sort in Ruby.
MIT License
8 stars 4 forks source link

Sort result is dependent of input order #2

Open zinga666 opened 9 years ago

zinga666 commented 9 years ago
irb(main):065:0> s1 = "string-1000"
irb(main):066:0> s2 = "string-1000-a"

irb(main):067:0> NaturalSort.sort([s1, s2]) == NaturalSort.sort([s2, s1])
=> false

irb(main):068:0> NaturalSort.sort([s1, s2])
=> ["string-1000", "string-1000-a"]
irb(main):069:0> NaturalSort.sort([s2, s1])
=> ["string-1000-a", "string-1000"]
johnnyshields commented 8 years ago

I would be glad to accept a PR which fixes this issue.