Monster.Types. Version

The version object contains a semantic version number

Constructor

new Version(major, minor, patch)

The version object contains a sematic version number

Parameters:
NameTypeDescription
major
minor
patch
Since
  • 1.0.0
Author
  • schukai GmbH
License
  • AGPLv3
Throws:
  • major is not a number

    Type
    Error
  • minor is not a number

    Type
    Error
  • patch is not a number

    Type
    Error
Example
import {Version} from '@schukai/monster/source/types/version.mjs';

new Version('1.0.0') // ↦ 1.0.0
new Version(1)  // ↦ 1.0.0
new Version(1, 0, 0) // ↦ 1.0.0
new Version('1.2.3', 4, 5) // ↦ 1.4.5

Members

(static) instanceSymbol

This method is called by the instanceof operator.

This method is called by the instanceof operator.

Since
  • 2.1.0

Methods

compareTo(version) → {number}

returns 0 if equal, -1 if the object version is less and 1 if greater than the compared version

.

returns 0 if equal, -1 if the object version is less and 1 if greater than the compared version

Parameters:
NameTypeDescription
versionstring | Version

Version to compare

Returns:
Type: 
number

toString() → {string}

Returns:
Type: 
string