semver 0.2.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 version = SemVer("1.0.0");
assert(version.isValid);
assert(version.isStable);
auto version = SemVer("1.0.0-rc.1");
assert(version.isValid);
assert(!version.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(version));
assert(SemVer("1.1.0").satisfies(version));
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.2.0 released 10 years ago
- dcarp/semver
- MIT
- Copyright © 2014 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
-
159 downloads this week
-
678 downloads this month
-
21046 downloads total
-
- Score:
- 4.0
- Short URL:
- semver.dub.pm