Fix SemVersion.isGtOrEq

This commit is contained in:
corpglory-dev 2019-02-06 19:59:28 +03:00
parent 43b5eba8ee
commit ee132c1091

View File

@ -20,12 +20,25 @@ export class SemVersion {
isGtOrEq(version: string): boolean {
const compared = new SemVersion(version);
return !(this.major < compared.major || this.minor < compared.minor || this.patch < compared.patch);
for (let i = 0; i < this.comparable.length; ++i) {
if (this.comparable[i] > compared.comparable[i]) {
return true;
}
if (this.comparable[i] < compared.comparable[i]) {
return false;
}
}
return true;
}
isValid(): boolean {
return _.isNumber(this.major);
}
get comparable() {
return [this.major, this.minor, this.patch];
}
}
export function isVersionGtOrEq(a: string, b: string): boolean {