@alextheman/utility - v4.3.5
    Preparing search index...

    Class VersionNumber

    Represents a software version number, considered to be made up of a major, minor, and patch part.

    Index

    Constructors

    Properties

    major: number = 0

    The major number. Increments when a feature is removed or changed in a way that is not backwards-compatible with the previous release.

    minor: number = 0

    The minor number. Increments when a new feature is added/deprecated and is expected to be backwards-compatible with the previous release.

    patch: number = 0

    The patch number. Increments when the next release is fixing a bug or doing a small refactor that should not be noticeable in practice.

    Accessors

    • get type(): VersionType

      Gets the current version type of the current instance of VersionNumber.

      Returns VersionType

      Either "major", "minor", or "patch", depending on the version type.

    Methods

    • Ensures that the VersionNumber behaves correctly when attempted to be coerced to a string.

      Parameters

      • hint: "string" | "number" | "default"

        Not used as of now, but generally used to help with numeric coercion, I think (which we most likely do not need for version numbers).

      Returns string

      A stringified representation of the current version number, prefixed with v.

    • Increments the current version number by the given increment type, returning the result as a new reference in memory.

      Parameters

      • incrementType: VersionType

        The type of increment. Can be one of the following:

        • "major": Change the major version v1.2.3v2.0.0
        • "minor": Change the minor version v1.2.3v1.3.0
        • "patch": Change the patch version v1.2.3v1.2.4

      Returns VersionNumber

      A new instance of VersionNumber with the increment applied.

    • Ensures that the VersionNumber behaves correctly when attempted to be converted to JSON.

      Returns string

      A stringified representation of the current version number, prefixed with v.

    • Get a string representation of the current version number.

      Parameters

      Returns string

      A stringified representation of the current version number, leaving out the prefix if omitPrefix option was set to true.

    • Checks if the provided version numbers have the exact same major, minor, and patch numbers.

      Parameters

      • firstVersion: VersionNumber

        The first version number to compare.

      • secondVersion: VersionNumber

        The second version number to compare.

      Returns boolean

      true if the provided version numbers have exactly the same major, minor, and patch numbers, and returns false otherwise.