Package-level declarations
Types
Functions
Returns cleaned (removed leading/trailing whitespace, remove '=v' prefix) and parsed version, or null if version is invalid.
Pass in a comparison string, and it'll call the corresponding semver comparison function. "===" and "!==" do simple string comparison, but are included for completeness. Throws if an invalid comparison string is provided.
Coerces a string to SemVer if possible
Compares two versions excluding build identifiers (the bit after +
in the semantic version string).
Compares two versions including build identifiers (the bit after +
in the semantic version string).
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.
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.
v1 v2
v1 >= v2
Return true if version is greater than all the versions possible in the range.
Return the version incremented by the release type (major, premajor, minor, preminor, patch, prepatch, or prerelease), or null if it's not valid.
Return true if any of the ranges comparators intersect
v1 < v2
v1 <= v2
Return true if version is less than all the versions possible in the range.
Return the major version number.
Return the highest version in the list that satisfies the range, or null if none of them do.
Return the minor version number.
Return the lowest version in the list that satisfies the range, or null if none of them do.
Return the lowest version that can possibly match the given range.
v1 != v2 The opposite of eq.
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.)
Return the parsed version as a SemVer object, or null if it's not valid.
Return the patch version number.
Returns an array of prerelease components, or null if none exist.
The reverse of compare.
Sorts an array of semver entries in descending order using compareBuild()
.
Return true if the version satisfies the range.
Return a "simplified" range that matches the same items in versions
list as the range specified. Note that it does not guarantee that it would match the same versions in all cases, only for the set of versions provided. This is useful when generating ranges by joining together multiple versions with ||
programmatically, to provide the user with something a bit more ergonomic. If the provided range is shorter in string-length than the generated range, then that is returned.
Sorts an array of semver entries in ascending order using compareBuild()
.
Return true if the subRange range is entirely contained by the superRange range.
Mostly just for testing and legacy API reasons
Return the parsed version as a string, or null if it's not valid.
Return the valid range or null if it's not valid