Browse Source

Adds version string conversion for compare

main
Eric Amodio 5 years ago
parent
commit
970111615f
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      src/system/version.ts

+ 8
- 1
src/system/version.ts View File

@ -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;

Loading…
Cancel
Save