node-semver
node-semver copied to clipboard
[QUESTION] includePrerelease usage
Hey, just wondering how do you use the prerelease tag in validRange
e.g.
const validated = valid('1.2.0-19', { includePrerelease: true})
With my understanding of includePrerelease
this would result to null
.
However, currently it returns 1.2.0-19
Is there perhaps another more suited method I should be looking at?
Thank you in advance~
Why would that be invalid? It's a range of one.
Is there a build-in method that checks for the -19
part ?
If there is a -19
returns invalid
Sorry, I mistyped. I was meant to say includePrerelease: false
A range won’t implicitly include prereleases when that option is set to false, but that is an exact version. This behavior seems correct to me.
Is there perhaps another way to identify an prerelease using semver ?
Are you looking for the prerelease function?
Something similar I guess.
But mainly looking for if i can accomplish these conditions with one function:
1.2.0-20
or ^1.2.0-20
fail (any version that supports pre release would fail)
>=1.2.20
pass
*
pass
1.2.0
pass
or would I have to layer a bunch of semver functions together to accomplish this ?
prerelease(version) === null
tells you exactly that.
Oh ! thank you so much!
I think this question has been answered. If not, please reopen or open a new issue.