Utility functions for operating on semantic versions.

Remember, increment the patch version (1.0.x) if you make a bugfix, increment the minor version (1.x.0) if you make a new feature (but previous content is still compatible), and increment the major version (x.0.0) if you make a breaking change (e.g. new API or reorganized file format).

Static methods

staticgetVersionFromJSON(input:Null<String>):Null<Version>

Get and parse the semantic version from a JSON string.

Parameters:

input

The JSON string to parse.

Returns:

The semantic version, or null if it could not be parsed.

staticparseVersion(input:Null<Dynamic>):Null<Version>

Get and parse the semantic version from a JSON string.

Parameters:

input

The JSON string to parse.

Returns:

The semantic version, or null if it could not be parsed.

@:nullSafety(Off)staticrepairVersion(version:Version):Version

staticvalidateVersion(version:Version, versionRule:VersionRule):Bool

Checks that a given verison number satisisfies a given version rule. Version rule can be complex, e.g. "1.0.x" or ">=1.0.0,<1.1.0", or anything NPM supports.

Parameters:

version

The semantic version to validate.

versionRule

The version rule to validate against.

Returns:

true if the version satisfies the rule, false otherwise.

staticvalidateVersionStr(version:String, versionRule:String):Bool

Checks that a given verison number satisisfies a given version rule. Version rule can be complex, e.g. "1.0.x" or ">=1.0.0,<1.1.0", or anything NPM supports.

Parameters:

version

The semantic version to validate.

versionRule

The version rule to validate against.

Returns:

true if the version satisfies the rule, false otherwise.