semver
semver copied to clipboard
NewRange does not like `>=3.0.0 <=3.193.0 || >3.196.0 <3.377.0 || >3.377.0`
Trying to parse >=3.0.0 <=3.193.0 || >3.196.0 <3.377.0 || >3.377.0
with NewVersion
results in the error "Given string does not resemble a Version". This is a possible version string according to https://docs.npmjs.com/cli/v6/using-npm/semver#advanced-range-syntax.
Hey James, alternates (conjunctiv, disjunctive) are not implemented, nor am I going to do so.
The reason for that is, one should be using a SAT-solver when it comes to that complexity – or for trivial cases implement Contains
and IsSatisfiedBy
for predicates AND
, OR
.
Though now with more experience, I’m open to rewrite the package to be easier usable with interfaces. If that’d move you forward say so and I’ll release a new version.
Though now with more experience, I’m open to rewrite the package to be easier usable with interfaces. If that’d move you forward say so and I’ll release a new version.
I don't follow the idea. Can you provide an example?
Also, I discovered this morning that semver.NewRange
will fail to parse >=1.0.0 <2.0.0
due to the trailing space character.
Input sanitation is out of scope of this library.
Interfaces are sth. like this in Go: interface { Contains(v Version) bool }
… and can only be implemented on pointer receiver(s) like func (v *Semver) Contains(v Version) bool {…}
Anyway, I’ll close this for now since the original use-case is clarified.