update to support compare functions

This commit is contained in:
2017-08-18 10:58:00 +02:00
parent ea6fc17f21
commit 79b0448444
4 changed files with 33 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import { SemVer } from 'semver'
export class SmartVersion {
semver: SemVer
versionString: string
update = {
patch: () => {
this.semver.patch = this.semver.patch + 1
@ -18,6 +19,7 @@ export class SmartVersion {
constructor (semVerStringArg: string) {
this.semver = new plugins.semver.SemVer(semVerStringArg)
this.versionString = this.semver.version
}
get major () {
@ -32,4 +34,12 @@ export class SmartVersion {
return this.semver.patch
}
greaterThanString (versionStringArg) {
return plugins.semver.gt(this.versionString, versionStringArg)
}
lessThanString (versionStringArg) {
return plugins.semver.lt(this.versionString, versionStringArg)
}
}