@alextheman/utility - v5.34.0
    Preparing search index...

    Class VersionNumber

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

    Index
    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.

    • 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.

    • 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.

    • Get a formatted string representation of the current version number

      Parameters

      • Optionaloptions: FormatStringOptions

        Options to apply to the string formatting.

      Returns string

      A formatted string representation of the current version number with the options applied.

    • 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.3 → v2.0.0
        • "minor": Change the minor version v1.2.3 → v1.3.0
        • "patch": Change the patch version v1.2.3 → v1.2.4
      • incrementAmount: number = 1

        The amount to increment by (defaults to 1).

      Returns VersionNumber

      A new instance of VersionNumber with the increment applied.

    • Checks if the current VersionNumber instance is bigger than the input VersionNumber.

      Parameters

      • comparator: VersionNumber

        The VersionNumber to compare against.

      Returns boolean

      true if the instance is bigger than the input, and false otherwise

    • Checks if the current VersionNumber instance is smaller than the input VersionNumber.

      Parameters

      • comparator: VersionNumber

        The VersionNumber to compare against.

      Returns boolean

      true if the instance is smaller than the input, and false otherwise

    • 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.

      Returns string

      A stringified representation of the current version number with the prefix.

    • Compares two given VersionNumber instances depending on order.

      Parameters

      Returns number

      0 if the version numbers are equal, 1 if the first version number is bigger than the second, and -1 if the first version number is smaller than the second.

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

      Parameters

      Returns boolean

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