Skip to content

SemVer.js

William edited this page Jan 17, 2024 · 1 revision

SemVer

SemVer module

Author: William Leemans
Copyright: William Leemans 2024

SemVer.semVer

A simple class to compare semantic version strings

Kind: static class of SemVer

semVer.parseSemanticVersion(version) ⇒ Array

Parse the given semantic version and return an Array with version information

Kind: static method of semVer
Returns: Array - [major, minor, bugfix, all other]

Param Type Description
version string A semantically correct version

semVer.eq(source, target) ⇒ boolean

Check if both given versions are the same

Kind: static method of semVer
Returns: boolean - Whether or not the versions are identical

Param Type Description
source string version to be compared with
target string version to compare

semVer.ne(source, target) ⇒ boolean

Check if versions are not equal (different)

Kind: static method of semVer
Returns: boolean - Whether or not the versions are NOT identical

Param Type Description
source string version to be compared with
target string version to compare

semVer.gt(source, target) ⇒ boolean

Check if the target version is greater than the source

Kind: static method of semVer
Returns: boolean - Whether or not the target version is greater than the source version

Param Type Description
source string version to be compared with
target string version to compare

semVer.gte(source, target) ⇒ boolean

Check if the target version is greater than or equal to the source

Kind: static method of semVer
Returns: boolean - Whether or not the target version is greater than or equal to the source version

Param Type Description
source string version to be compared with
target string version to compare

semVer.lt(source, target) ⇒ boolean

Check if the target version is less than the source

Kind: static method of semVer
Returns: boolean - Whether or not the target version is less than the source version

Param Type Description
source string version to be compared with
target string version to compare

semVer.lte(source, target) ⇒ boolean

Check if the target version is less than or equal to the source

Kind: static method of semVer
Returns: boolean - Whether or not the target version is less than or equal to the source version

Param Type Description
source string version to be compared with
target string version to compare