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
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 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/version.js';
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
Methods
# compareTo(version) → {number}
returns 0 if equal, -1 if the object version is less and 1 if greater then the compared version
Parameters:
Name | Type | Description |
---|---|---|
version |
string | Version | Version to compare |
Returns:
- Type
- number
# toString() → {string}
Returns:
- Type
- string