Skip to content

Conversation

@amitse
Copy link
Contributor

@amitse amitse commented Sep 7, 2022

Update range.js comments to clarify the caret examples

Caret (^) - does not modify the left-most non-zero element in the M.m.p-e. Tilde (~) - does not modify M and m.

hence, ^0.0.1-1 matches 0.0.1-5
however, ~0.0.1-1 matches 0.0.5
which might be counterintuitive and hence adding this example explicitly.

References

Update range.js comments to clarify the caret exaples Caret (^) - does not modify the left-most non-zero element in the M.m.p-e. Tilde (~) - does not modify M and m. hence, ^0.0.1-1 matches 0.0.1-5 however, ~0.0.1-1 matches 0.0.5 which might be counterintuitive and hence adding this example explicitly.
@amitse amitse requested a review from a team as a code owner September 7, 2022 09:03
@amitse amitse changed the title Update range.js Update range.js comments to clarify the caret ranges examples comment. Sep 9, 2022
@wraithgar wraithgar changed the title Update range.js comments to clarify the caret ranges examples comment. docs: Update range.js comments to clarify the caret ranges examples comment. Oct 4, 2022
@wraithgar
Copy link
Member

Thanks, the "leading zeroes with caret ranges" is definitely one of the finer points of semver that trip people up. Anything that adds clarification is probably a good idea.

@wraithgar wraithgar changed the title docs: Update range.js comments to clarify the caret ranges examples comment. docs: update range.js comments to clarify the caret ranges examples Oct 4, 2022
@wraithgar wraithgar merged commit 7209b14 into npm:main Oct 4, 2022
@github-actions github-actions bot mentioned this pull request Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants