mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix SemVersion.isGtOrEq
This commit is contained in:
@@ -20,12 +20,25 @@ export class SemVersion {
|
|||||||
|
|
||||||
isGtOrEq(version: string): boolean {
|
isGtOrEq(version: string): boolean {
|
||||||
const compared = new SemVersion(version);
|
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 {
|
isValid(): boolean {
|
||||||
return _.isNumber(this.major);
|
return _.isNumber(this.major);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get comparable() {
|
||||||
|
return [this.major, this.minor, this.patch];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isVersionGtOrEq(a: string, b: string): boolean {
|
export function isVersionGtOrEq(a: string, b: string): boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user