From 970111615faf3ed93a5712268d9859d43aac0594 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Tue, 10 Sep 2019 23:29:56 -0400 Subject: [PATCH] Adds version string conversion for compare --- src/system/version.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/system/version.ts b/src/system/version.ts index 898ec6a..28448ea 100644 --- a/src/system/version.ts +++ b/src/system/version.ts @@ -10,7 +10,14 @@ export namespace Versions { pre?: string; } - export function compare(v1: Version, v2: Version): VersionComparisonResult { + export function compare(v1: string | Version, v2: string | Version): VersionComparisonResult { + if (typeof v1 === 'string') { + v1 = fromString(v1); + } + if (typeof v2 === 'string') { + v2 = fromString(v2); + } + if (v1.major > v2.major) return 1; if (v1.major < v2.major) return -1;