Constructor
new Version(major, minor, patch)
The version object contains a sematic version number
Parameters:
Name | Type | Description |
---|---|---|
major | ||
minor | ||
patch |
- Since
- 1.0.0
- Copyright
- 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:
Name | Type | Description |
---|---|---|
version | string | | Version to compare |
Returns:
- Type:
- number
toString() → {string}
Returns:
- Type:
- string