Class: Versions

Versions()

Version Number related methods

Constructor

new Versions()

Source:

Methods

(static) compare(firstVersion, secondVersion, operator) → {boolean|integer}

Compare [semver](https://semver.org/) version strings.
Parameters:
Name Type Description
firstVersion string First version to compare
secondVersion string Second version to compare
operator string | null Optional; Arithmetic operator to use (>, >=, =, <=, <, !=). Defaults to `null`.
Source:
Returns:
If operator is not `null`: true` if the comparison between the firstVersion and the secondVersion satisfies the operator, `false` otherwise. If operator is `null`: Numeric value compatible with the [Array.sort(fn) interface](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters). ```
Type
boolean | integer

(static) findCompatible(wkVersions, preferProduction, minVersion, maxVersion) → {Array.<object>}

Tries to determine the most suitable version from a well-known discovery document that software is compatible to.
Parameters:
Name Type Default Description
wkVersions array A well-known discovery document compliant to the API specification.
preferProduction boolean true Set to `false` to make no difference between production and non-production versions.
minVersion string | null null The minimum version that should be returned.
maxVersion string | null null The maximum version that should be returned.
Source:
Returns:
- Gives a list that lists all compatible versions (as still API compliant objects) ordered from the most suitable to the least suitable.
Type
Array.<object>

(static) findLatest(wkVersions, preferProduction, minVersion, maxVersion) → {object|null}

Find the latest version from well-known discovery that applies to the specified rules. This is basically the same as calling `findCompatible` and using the first element from the result.
Parameters:
Name Type Default Description
wkVersions array A well-known discovery document compliant to the API specification.
preferProduction boolean true Set to `false` to make no difference between production and non-production versions.
minVersion string | null null The minimum version that should be returned.
maxVersion string | null null The maximum version that should be returned.
Source:
Returns:
Type
object | null

(static) validate(version)

Validate [semver](https://semver.org/) version strings.
Parameters:
Name Type Description
version * Version number to validate
Source:
Returns:
- `true` if the version number is a valid semver version number, `false` otherwise.