<< requiremodule | Modules manager | toolboxdir >> |
r = semver(version_str, version_range) |
a string: current version.
a string: version to compare or range.
a double: -1, 0 or 1.
semver compares a version string to an version or an range version.
if an range version is used, r return 0 (not satisfied) or 1 (satisfied).
if an simple version is used, an comparaison value r is returned -1 (inferior), 0 (equal) or 1 (superior).
supported range operators:
= - Equality
>= - Higher or equal to
<= - Lower or equal to
< - Lower than
> - Higher than
^ - Caret operator comparison
~ - Tilde operator comparison
semver('1.5.10', '2.3.0')
semver('2.3.0', '1.5.10');
semver('1.5.10', '1.5.10')
semver('1.2.3', '~1.2.3')
semver('1.5.3', '~1.2.3')
semver('1.0.3', '~1')
semver('2.0.3', '~1')
semver('1.2.3-alpha', '>1.2.3-beta')
semver('1.2.3-alpha', '<1.2.3-beta')
semver('1.2.3', '^1.2.3')
semver('1.2.2', '^1.2.3')
semver('1.9.9', '^1.2.3')
semver('2.0.1', '^1.2.3')
Version | Description |
---|---|
1.0.0 | initial version |
Allan CORNET