From ee132c1091dc2fc29caaf5e38a3886da6fc82283 Mon Sep 17 00:00:00 2001 From: corpglory-dev Date: Wed, 6 Feb 2019 19:59:28 +0300 Subject: [PATCH] Fix SemVersion.isGtOrEq --- public/app/core/utils/version.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/public/app/core/utils/version.ts b/public/app/core/utils/version.ts index 1131e1d2ab8..746de761fa3 100644 --- a/public/app/core/utils/version.ts +++ b/public/app/core/utils/version.ts @@ -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 {