@aurigma/design-atoms
Version:
Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.
25 lines • 1.12 kB
JavaScript
import { Exception } from "@aurigma/design-atoms-model/Exception";
var Version = /** @class */ (function () {
function Version(_major, _minor, _patch) {
this._major = _major;
this._minor = _minor;
this._patch = _patch;
}
Version.fromString = function (source) {
if (source == null)
throw new Exception("componentVersion must not be null.");
var 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]));
};
Version.prototype.isCompatibleTo = function (version) {
return this._major === version._major && this._minor === version._minor && this._isDevVersion() == version._isDevVersion();
};
Version.prototype._isDevVersion = function () {
return this._patch >= 100;
};
return Version;
}());
export { Version };
//# sourceMappingURL=Version.js.map