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"));
- 0.2.0 released 12 years ago
- dcarp/semver
- MIT
- Copyright © 2014 Dragoş Carp
- Authors:
- Dependencies:
- none
- Versions:
-
Show all 19 versions0.8.0 2026-Mar-24 0.7.1 2026-Mar-01 0.7.0 2026-Feb-28 0.6.0 2025-Sep-21 0.5.0 2023-Mar-30 - Download Stats:
-
-
15 downloads today
-
149 downloads this week
-
1154 downloads this month
-
31219 downloads total
-
- Score:
- 3.9
- Short URL:
- semver.dub.pm