Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Function to check for validity of a prerelease identifier #350

Open
boxcee opened this issue Nov 11, 2020 · 1 comment
Open

[FEATURE] Function to check for validity of a prerelease identifier #350

boxcee opened this issue Nov 11, 2020 · 1 comment
Labels
Enhancement new feature or improvement

Comments

@boxcee
Copy link

boxcee commented Nov 11, 2020

What / Why

Problem described in #349: An 'invalid' identifier will lead to an invalid semver.
Now, there is no way to check beforehand whether an identifier is valid, except doing this:

const isValidIdentifier(identifier) => !!valid(inc(parse('0.0.1'), 'prerelease', identifier));

This is a request for a more straight-forward function, e.g. identifier(), which returns null (or false) if the identifier is invalid.

References

@mbtools
Copy link
Contributor

mbtools commented Jan 21, 2025

#754 adds a check to inc. Do we need a new function when you can just look up the spec to see what's valid for a pre-release?

Or get the regex for it from semver:

semver.src[semver.tokens.PRERELEASE]
semver.src[semver.tokens.PRERELEASEIDENTIFIER]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement new feature or improvement
Projects
None yet
4 participants
@lukekarrys @boxcee @mbtools and others