thx.semver

Semantic version library for Haxe. It follows the specifications for Semantic Versioning 2.0.0 described at http://semver.org/
https://github.com/fponticelli/thx.semver

To install, run:

haxelib install thx.semver 0.2.2 

See using Haxelib in Haxelib documentation for more information.

README.md

thx.semver

Build Status

Version

Semantic Version library for Haxe. The library provides an abstract type thx.semver.Version that represents a release version as described in the Semantic Versioning Specification 2.0.0.

To create a version you can use a string:

var v : Version = '1.2.3';

Or an array:

var v : Version= [1,2,3];

In this case you will not be able to specify a pre-release (pre) or a build value. But you can integrate using one of the transformation methods:

var v = ([1,2,3] : Version).withBuild('abc');

Versions can be easily compared:

('1.0.0' : Version) > ('1.0.0-alpha' : Version) // yields true

A version with pre-release and build looks like:

var v : Version = '1.0.0-alpha+build.12'

Also generating new versions is very easy:

var v : Version = '0.9.17';
trace(v.nextMinor()); // echoes '0.10.0'

Version Rules

thx.semver support the same SemVer patterns adopted for npm-semver. Note that this is neither a wrapper or a port but a library that conforms to the same specifications.

The simplest way to define a Version Rule is to use the string format:

var rule : VersionRule = '1.x || >=2.5.0 || 5.0.0 - 7.2.3';
rule.isSatisfiedBy('1.2.3'); // holds true

You can also operate in the other direction:

('1.2.3' : Version).satisfies('1.x || >=2.5.0 || 5.0.0 - 7.2.3'); // holds true

For more details on the patterns, refer to the previous link.

install

From the command line just type:

haxelib install thx.semver

To use the dev version do:

haxelib git thx.core https://github.com/fponticelli/thx.semver.git
Contributors
fponticelli
Version
0.2.2
Published
3 years ago
License
MIT

All libraries are free

Every month, more than thousand developers use haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on Github!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on Github