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#compare(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#valid()}: Checks if the version is valid.
{@link Semver#incMajor()}: Increments the major version.
{@link Semver#incMinor()}: Increments the minor version.
{@link Semver#incPatch()}: Increments the patch version.
{@link Semver#incPreRelease()}: Increments the pre-release version.
{@link Semver#incBuild()}: Increments the build 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?