smartversion/dist/index.js

49 lines
3.1 KiB
JavaScript
Raw Permalink Normal View History

2017-08-17 14:15:47 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./smartversion.plugins");
class SmartVersion {
constructor(semVerStringArg) {
this.update = {
patch: () => {
this.semver.patch = this.semver.patch + 1;
},
minor: () => {
this.semver.minor = this.semver.minor + 1;
},
major: () => {
this.semver.major = this.semver.major + 1;
}
};
this.semver = new plugins.semver.SemVer(semVerStringArg);
2017-08-18 08:58:00 +00:00
this.versionString = this.semver.version;
2017-08-17 14:15:47 +00:00
}
get major() {
return this.semver.major;
}
get minor() {
return this.semver.minor;
}
get patch() {
return this.semver.patch;
}
greaterThan(smartVersionArg) {
return this.greaterThanString(smartVersionArg.versionString);
}
/**
* compares the version of this against a string
*/
2017-08-18 08:58:00 +00:00
greaterThanString(versionStringArg) {
return plugins.semver.gt(this.versionString, versionStringArg);
}
lessThan(smartVersionArg) {
return this.lessThanString(smartVersionArg.versionString);
}
/**
* compares the version of this against a string
*/
2017-08-18 08:58:00 +00:00
lessThanString(versionStringArg) {
return plugins.semver.lt(this.versionString, versionStringArg);
}
2017-08-17 14:15:47 +00:00
}
exports.SmartVersion = SmartVersion;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGtEQUFpRDtBQUlqRDtJQWVFLFlBQWEsZUFBdUI7UUFacEMsV0FBTSxHQUFHO1lBQ1AsS0FBSyxFQUFFO2dCQUNMLElBQUksQ0FBQyxNQUFNLENBQUMsS0FBSyxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUMsS0FBSyxHQUFHLENBQUMsQ0FBQTtZQUMzQyxDQUFDO1lBQ0QsS0FBSyxFQUFFO2dCQUNMLElBQUksQ0FBQyxNQUFNLENBQUM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