semver 0.5.0
Semantic Versioning Library
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
semver
Semantic Versioning Library
Implementation
This library parses, validates and compares version numbers and version ranges.
It uses the following formats:
- Semantic Versioning 2.0.0 - http://semver.org
- Semantic Versioning Range - https://github.com/isaacs/node-semver
Usage
auto version1 = SemVer("1.0.0");
assert(version1.isValid);
assert(version1.isStable);
auto version2 = SemVer("1.0.0-rc.1");
assert(version2.isValid);
assert(!version2.isStable);
assert(SemVer("1.0.0") > SemVer("1.0.0+build.1"));
assert(SemVer("1.0.0").differAt(SemVer("1.0.0+build.1")) == VersionPart.BUILD);
auto versionRange = SemVerRange(">=1.0.0");
assert(versionRange.isValid);
assert(SemVer("1.0.1").satisfies(versionRange));
assert(SemVer("1.1.0").satisfies(versionRange));
auto semVers = [SemVer("1.1.0"), SemVer("1.0.0"), SemVer("0.8.0")];
assert(semVers.maxSatisfying(SemVerRange("<=1.0.0")) == SemVer("1.0.0"));
assert(semVers.maxSatisfying(SemVerRange(">=1.0")) == SemVer("1.1.0"));
semVers = [SemVer("1.0.0+build.3"), SemVer("1.0.0+build.1"), SemVer("1.1.0")];
assert(semVers.maxSatisfying(SemVerRange("<=1.0.0")) == SemVer("1.0.0+build.3"));
assert(semVers.maxSatisfying(SemVerRange(">=1.0")) == SemVer("1.1.0"));
- Registered by Dragos Carp
- 0.5.0 released a year ago
- dcarp/semver
- MIT
- Copyright © 2014-2017 Dragoş Carp
- Authors:
- Dependencies:
- none
- Versions:
-
0.5.0 2023-Mar-30 0.4.0 2022-Oct-20 0.3.4 2021-Sep-01 0.3.3 2021-Jun-06 0.3.2 2017-Dec-31 - Download Stats:
-
-
19 downloads today
-
141 downloads this week
-
620 downloads this month
-
21709 downloads total
-
- Score:
- 4.1
- Short URL:
- semver.dub.pm