UNPKG

@aurigma/design-atoms

Version:

Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.

23 lines 968 B
import { Exception } from "@aurigma/design-atoms-model/Exception"; export class Version { constructor(_major, _minor, _patch) { this._major = _major; this._minor = _minor; this._patch = _patch; } static fromString(source) { if (source == null) throw new Exception("componentVersion must not be null."); const matchResult = source.match(/^(\d+).(\d+).(\d+)/); if (matchResult == null) throw new Exception(`Source string '${source}' does not contains version.`); return new Version(Number.parseInt(matchResult[1]), Number.parseInt(matchResult[2]), Number.parseInt(matchResult[3])); } isCompatibleTo(version) { return this._major === version._major && this._minor === version._minor && this._isDevVersion() == version._isDevVersion(); } _isDevVersion() { return this._patch >= 100; } } //# sourceMappingURL=Version.js.map