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

[DOCS] No mention of ranges such as >3. #275

Closed
Tracked by #581
coreyfarrell opened this issue Apr 1, 2019 · 3 comments · Fixed by #569
Closed
Tracked by #581

[DOCS] No mention of ranges such as >3. #275

coreyfarrell opened this issue Apr 1, 2019 · 3 comments · Fixed by #569
Labels
Needs Documentation pull request requires docs before merging

Comments

@coreyfarrell
Copy link
Contributor

$ node -e "console.log(require('semver').Range('>3'))"
Range {
  options: { loose: false, includePrerelease: false },
  loose: false,
  includePrerelease: false,
  raw: '>3',
  set: [ [ [Comparator] ] ],
  range: '>=4.0.0' }

This behavior of the greater than range with missing minor/patch is not documented. Based on the documentation I had expected that >3 and >3.0.0 were the same range.

A similar thing happens with >3.0 becoming >=3.1.0, though >3.0.0 remains >3.0.0.

@isaacs
Copy link
Contributor

isaacs commented Apr 1, 2019

Yes, this should be documented, but kind of makes sense if you think about it. >3.x means "greater than any version matching 3.x", so if 3.0.1 matched it, then that would be surprising, since 3.0.1 isn't "greater than" 3.x, it is 3.x.

@isaacs
Copy link
Contributor

isaacs commented Apr 1, 2019

Also, >n should be equivalent to >=(n+1) so >3 should be equivalent to >=4

@coreyfarrell
Copy link
Contributor Author

Thank you for the 'greater than any version matching 3.x' explanation, that makes sense to me. Ultimately >3 is the same as >3.x or >3.x.x, not the same as >3.0 or >3.0.0.

@darcyclarke darcyclarke changed the title docs: No mention of ranges such as >3. [DOCS] No mention of ranges such as >3. Jul 28, 2022
@lukekarrys lukekarrys added the Needs Documentation pull request requires docs before merging label Oct 27, 2022
mbtools added a commit to mbtools/node-semver that referenced this issue Jun 16, 2023
lukekarrys pushed a commit that referenced this issue Jun 22, 2023
Adds an example clarifying how greater-than comparator works.

## References

Closes #275
@Gornator Gornator mentioned this issue Jul 2, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Documentation pull request requires docs before merging
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants