Visitar URL original
[DOCS] No mention of ranges such as `>3`. · Issue #275 · npm/node-semver · GitHub
Skip to content

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

Closed

Description

@coreyfarrell
$ 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.

Activity

  1. isaacs commented on Apr 1, 2019

    @isaacs
    Contributor

    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.

  2. isaacs commented on Apr 1, 2019

    @isaacs
    Contributor

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

  3. coreyfarrell commented on Apr 1, 2019

    @coreyfarrell
    ContributorAuthor

    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.

  4. changed the title [-]docs: No mention of ranges such as `>3`.[/-] [+][DOCS] No mention of ranges such as `>3`.[/+] on Jul 28, 2022
  5. added a commit that references this issue on Jun 16, 2023
    b8ea889
  6. added a commit that references this issue on Jun 22, 2023
    bf53dd8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs Documentationpull request requires docs before merging

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions