A version number following semantic versioning. See https://semver.org/lang/de/

interface SemVer {
    build: string;
    compare(other: SemVer): number;
    equals(other: SemVer): boolean;
    hotfix: number;
    isPrerelease: boolean;
    lowestPreRelease(): SemVer;
    major: number;
    minor: number;
    patch: number;
    prerelease: readonly string[];
    stripBuild(): SemVer;
    stripPreRelease(): SemVer;
    toString(): string;
    version: string;
}

Properties

build: string

The build number part of the version. e.g. 20240122001 from 1.2.3+20240122001

hotfix: number

The hot fix part of the version e.g. 4 from 1.2.3.4

This should not be used anymore.

isPrerelease: boolean

Indicates that the version is a pre-release version.

major: number

The major part of the version e.g. 1 from 1.2.3

minor: number

The minor part of the version e.g. 2 from 1.2.3

patch: number

The patch part of the version e.g. 3 from 1.2.3

prerelease: readonly string[]

The parts of the pre-release string of the version e.g. [RC, 1] from 1.2.3-RC-1

version: string

The version as text.

Methods

  • Compares this version to another version.

    Parameters

    • other: SemVer

      The other version.

    Returns number

    x < 0: this version lower, x > 0:this version greater, x = 0: both versions are equal

  • Check, if this version equals another version.

    Parameters

    • other: SemVer

      The other version.

    Returns boolean

    true if the versions are equal.

  • Creates the lowest pre-release version of this version. The lowest pre-release version is a version with the pre-release -0 post fix. e.g. 1.2.3-0

    Returns SemVer

    The lowest pre-release version.

  • Creates a new version without the build part.

    Returns SemVer

    A new version without the build part or the same version, if it has no build part.

  • Creates new version without pre-release information.

    Returns SemVer

    A new version without the pre-release part or the same version if it has no pre-release part.

  • String representation of the version.

    Returns string

    The version as String.