@ts-common/azure-js-dev-tools
Version:
Developer dependencies for TypeScript related projects
40 lines • 1.32 kB
JavaScript
;
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Version = void 0;
var Version = /** @class */ (function () {
function Version(version) {
var parts = version.split("-");
this.suffix = parts[1];
var numbers = parts[0].split(".");
this.major = Number.parseInt(numbers[0]);
this.minor = Number.parseInt(numbers[1]);
this.patch = Number.parseInt(numbers[2]);
}
Version.parse = function (version) {
return new Version(version);
};
Version.prototype.bumpMajor = function () {
this.major = this.major + 1;
this.minor = 0;
this.patch = 0;
};
Version.prototype.bumpMinor = function () {
this.minor = this.minor + 1;
this.patch = 0;
};
Version.prototype.bumpPatch = function () {
this.patch = this.patch + 1;
};
Version.prototype.toString = function () {
var suffix = this.suffix ? "-" + this.suffix : "";
return this.major + "." + this.minor + "." + this.patch + suffix;
};
return Version;
}());
exports.Version = Version;
//# sourceMappingURL=version.js.map