GetSemver
Parses and returns a Semver object version of the passed version string or if you do not pass in a version, we will return to you a Semver builder {@link Semver#of()} object, so you can programmaticaly build a version object.
Semver is a tool that provides useful methods to manipulate versions that follow the "semantic versioning" specification (see semver.org and github).
Some of the methods provided by Semver are:
{@link Semver#compareTo(Semver)}: Compares two versions and returns -1, 0, or 1 if the first version is less than, equal to, or greater than the second version, respectively.
{@link Semver#satisfies(String)}: Checks if the version satisfies the given range.
{@link Semver#isValid(String)}: Checks if the version is valid.
{@link Semver#nextMajor()}: Increments the major version.
{@link Semver#nextMinor()}: Increments the minor version.
{@link Semver#nextPatch()}: Increments the patch version.
{@link Semver#withBuild(String)}: Set the build version.
{@link Semver#withPreRelease(String)}: Set the pre-release version.
{@link Semver#isStable()}: Checks if the version is stable.
Here are some examples of how to parse and manipulate versions using Semver:
Here are some examples of comparing versions using Semver:
To use the builder you can do something like this:
Method Signature
Arguments
version
string
false
The version string to parse.
Examples
Related
Last updated
Was this helpful?