Open Wilfred opened 8 years ago
Hi
To sort those versions, you need to specify correct semantic versions, otherwise lib thinks that you're trying to sort fractions, and as fractions, they are already properly sorted.
In other way, just try:
var naturalSort = require("natural-sort")
var x = ['0.16.0', '0.2.0'];
x.sort(naturalSort());
@ArmorDarks many thanks for your help here!
We’re working on a test suite to have this properly covered. The readme is a bit newer than what was released with 1.0.0, so please don’t rely on it yet. Sorry for the non-responsiveness and for the confusion – urgent stuff forced me to switch to other things before I finished off the streak with this lib.
Should be ready by the end of the week.
This leaves
x
unchanged. I was hoping natural-sort would handle strings that look something like versions.