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

Implement all semver methods #3

Open
9 of 23 tasks
LucianBuzzo opened this issue Jul 20, 2017 · 2 comments
Open
9 of 23 tasks

Implement all semver methods #3

LucianBuzzo opened this issue Jul 20, 2017 · 2 comments

Comments

@LucianBuzzo
Copy link
Contributor

LucianBuzzo commented Jul 20, 2017

  • valid(v): Return the parsed version, or null if it's not valid.

  • inc(v, release): Return the version incremented by the release type (major, premajor, minor, preminor, patch, prepatch, or prerelease), or null if it's not valid

  • prerelease(v): Returns an array of prerelease components, or null if none exist. Example: prerelease('1.2.3-alpha.1') -> ['alpha', 1]

  • major(v): Return the major version number.

  • minor(v): Return the minor version number.

  • patch(v): Return the patch version number.

  • gt(v1, v2): v1 > v2

  • gte(v1, v2): v1 >= v2

  • lt(v1, v2): v1 < v2

  • lte(v1, v2): v1 <= v2

  • eq(v1, v2): v1 == v2 This is true if they're logically equivalent, even if they're not the exact same string. You already know how to compare strings.

  • neq(v1, v2): v1 != v2 The opposite of eq.

  • cmp(v1, comparator, v2): Pass in a comparison string, and it'll call the corresponding function above. "===" and "!==" do simple string comparison, but are included for completeness. Throws if an invalid comparison string is provided.

  • compare(v1, v2): Return 0 if v1 == v2, or 1 if v1 is greater, or -1 if v2 is greater. Sorts in ascending order if passed to Array.sort().

  • rcompare(v1, v2): The reverse of compare. Sorts an array of versions in descending order when passed to Array.sort().

  • diff(v1, v2): Returns difference between two versions by the release type (major, premajor, minor, preminor, patch, prepatch, or prerelease), or null if the versions are the same.

  • validRange(range): Return the valid range or null if it's not valid

  • satisfies(version, range): Return true if the version satisfies the range.

  • maxSatisfying(versions, range): Return the highest version in the list that satisfies the range, or null if none of them do.

  • minSatisfying(versions, range): Return the lowest version in the list that satisfies the range, or null if none of them do.

  • gtr(version, range): Return true if version is greater than all the versions possible in the range.

  • ltr(version, range): Return true if version is less than all the versions possible in the range.

  • outside(version, range, hilo): Return true if the version is outside the bounds of the range in either the high or low direction. The hilo argument must be either the string '>' or '<'. (This is the function called by gtr and ltr.)

@LucianBuzzo
Copy link
Contributor Author

LucianBuzzo commented Sep 12, 2017

Methods used by the SDK

  • prerelease
  • maxSatisfying
  • rcompare
  • parse
  • lt

@LucianBuzzo
Copy link
Contributor Author

LucianBuzzo commented Sep 12, 2017

Methods used by the CLI

  • satisfies

@LucianBuzzo LucianBuzzo reopened this Sep 12, 2017
LucianBuzzo added a commit that referenced this issue Sep 14, 2017
Connects to #3

change-type: minor
LucianBuzzo added a commit that referenced this issue Sep 14, 2017
Connects to #3

change-type: minor
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

No branches or pull requests

1 participant