semver 0.3.1

Semantic Versioning Library


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

Build Status

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"));

Authors: Dragoş Carp

Dependencies: none

Versions:
0.3.1 2016-Apr-07
0.3.0 2016-Feb-13
0.2.1 2015-Apr-02
0.2.0 2014-Sep-12
0.1.0 2014-Jun-16
Show all 6 versions
Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 309 downloads total