SimVersion

SimVersion

new SimVersion(major, minor, maintenance, optionsopt)

Parameters:
Name Type Attributes Description
major number | string The major part of the version (the 3 in 3.1.2)
minor number | string The minor part of the version (the 1 in 3.1.2)
maintenance number | string The maintenance part of the version (the 2 in 3.1.2)
options Object <optional>

Methods

(static) comparator(a, b)

Compares versions in standard "comparator" static format, returning -1 if the first parameter SimVersion is before the second parameter SimVersion in version-string, 0 if equal, or 1 if the first parameter SimVersion is after.
Parameters:
Name Type Description
a SimVersion
b SimVersion

(static) deserialize() → {SimVersion}

Takes a serialized form of the SimVersion and returns an actual instance.
Parameters:
Type Description
Object with properties like major, minor, maintenance, testType, testNumber, and buildTimestamp
Returns:
Type
SimVersion

(static) fromBranch(branch) → {SimVersion}

Parses a branch in the form {{MAJOR}}.{{MINOR}} and returns a corresponding version. Uses 0 for the maintenance version (unknown).
Parameters:
Name Type Description
branch string e.g. '1.0'
Returns:
Type
SimVersion

(static) parse(versionString, buildTimestampopt) → {SimVersion}

Parses a sim version from a string form.
Parameters:
Name Type Attributes Description
versionString string e.g. '1.0.0', '1.0.1-dev.3', etc.
buildTimestamp string <optional>
Optional build timestamp, like '2015-06-12 16:05:03 UTC' (phet.chipper.buildTimestamp)
Returns:
Type
SimVersion

compareNumber(version)

Compares versions, returning -1 if this version is before the passed in version, 0 if equal, or 1 if this version is after.
Parameters:
Name Type Description
version SimVersion

isAfter(version) → {boolean}

Returns true if the specified version is strictly after this version
Parameters:
Name Type Description
version SimVersion
Returns:
Type
boolean

isBeforeOrEqualTo(version) → {boolean}

Returns true if the specified version matches or comes before this version.
Parameters:
Name Type Description
version
Returns:
Type
boolean

serialize() → {Object}

Convert into a plain JS object meant for JSON serialization.
Returns:
- with properties like major, minor, maintenance, testType, testNumber, and buildTimestamp
Type
Object

toString() → {string}

Returns the string form of the version. Like "1.3.5".
Returns:
Type
string