Version

Moduleejs.version
Definition class Version
InheritanceVersion inherit Object
StabilityPrototype.

Version class supporting Semantic Versioning 2.0.0.


Properties

QualifiersPropertyTypeDescription
get compatible The major.minor API compatible version number.
get debugBooleanThe version is a pre-release version This may be due to the version having a pre-release suffix, or if not a pure SemVer version, it may have non-number components that indicate a pre-release.
get major The major release number portion of the version 8.
get minor The minor release number portion of the version 8.
get number The version as a single number.
get patch The minor release number portion of the version 8.
get pre The pre-release portion of the version.
get valid Test if the constructed version is valid.
get version The public portion of the version without any prereleases qualification 8.

Version Class Methods

QualifiersMethod
static sort(versions, direction = 1): Array
 Sort an array of versions.

Version Instance Methods

QualifiersMethod
Version(version: String)
 Create and parse a version Use valid() to test if the version string was a valid SemVer version.
acceptable(criteria): Boolean
 Test if the version is acceptable based on the supplied critera.
same(other: String)
 Compare versions.
override toString()
 null

Method Detail

ejs.version Version(version: String)
Description
Create and parse a version Use valid() to test if the version string was a valid SemVer version.

acceptable(criteria): Boolean
Description
Test if the version is acceptable based on the supplied critera.
Parameters
criteria The acceptable formats for criteria are:
 VER                             Allows prereleases ^ VER                           Same as >=1.2.3 <2.0.0 (does not allow prereleases) ~ VER                           Same as >=1.2.3 <2.0.0 (allows prereleases) 1.2.X                           Any version starting with 1.2 (allows prereleases) [>, >=, <, <=, ==, !=] VER EXPR || EXPR ... EXPR && EXPR ... EXPR EXPR ... 
Returns
True if the version is acceptable.

same(other: String)
Description
Compare versions.
Parameters
other: String Other version to compare with this one Can be a version or a string.
Returns
True if the versions are identical.

static sort(versions, direction = 1): Array
Description
Sort an array of versions. The version strings can be pathnames where the basename is the version.
Parameters
direction null [default: 1]