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

add isSemver() #1230

Closed
wants to merge 2 commits into from
Closed

add isSemver() #1230

wants to merge 2 commits into from

Conversation

tanpero
Copy link

@tanpero tanpero commented Jan 12, 2020

No description provided.

Copy link
Member

@profnandaa profnandaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for the most part. Please add the tests.

Copy link
Member

@tux-tn tux-tn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tanpero @profnandaa lookbehind assertions have been added in ES2018 specification . The regex won't work on browsers/platforms not implementing ES2018.
I suggest using the regex provided by semver.org . They are even providing the test cases https://regex101.com/r/lLc0SL/1

^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$

@profnandaa
Copy link
Member

@tanpero @profnandaa lookbehind assertions have been added in ES2018 specification . The regex won't work on browsers/platforms not implementing ES2018.
I suggest using the regex provided by semver.org . They are even providing the test cases https://regex101.com/r/lLc0SL/1

^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$

Thanks for the catch, Sarhan. @tanpero -- please address.

@AubreyHewes
Copy link

@tanpero done by #1246 ?

@profnandaa
Copy link
Member

Sure.

@profnandaa profnandaa closed this Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants