semver.clean() returns null on some version strings
Hello, i am not sure if this is a bug.
I noticed that semver.clean('5.4.0~oneric+3') returns null, I can reproduce this with any version string containing ~ or +.
My workaround currently is to replace ~ and + with - before passing it.
Could the function be corrected to either strip or ignore these characters?
Yep. That's a bug.
+1
A remove of all unneeded chars at beginning would be great, e. g. for #v1.2.3 too.
Quickfix (untested, but ok for my intend), change var semver
var semver = "\\s*(?:.+?)?\\s*([0-9]+)" // major (ignore all chars before number)
+ "\\.([0-9]+)" // minor
+ "\\.([0-9]+)" // patch
+ "(-[0-9a-zA-Z]+-?)?" // build (e.g. "-rc1")
+ "(.+?)?\\s?" // tag (everything else, until \s)
But i am not sure about split build and tag, -alpha.1 returns build alpha tag .1
Tilde for separating the prerelease isn't valid according to semver.org. Closing this.