diff --git a/__tests__/versionutil.test.ts b/__tests__/versionutil.test.ts index a238688..b816013 100644 --- a/__tests__/versionutil.test.ts +++ b/__tests__/versionutil.test.ts @@ -42,7 +42,6 @@ describe('version tests', () => { '.2.3', '.2.x', '1', - '2.x', '*.*.1', '*.1', '*.', diff --git a/dist/index.js b/dist/index.js index aadf381..9febcc2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -16869,20 +16869,14 @@ class DotNetVersionInfo { return; } //Note: No support for previews when using generic - let parts = version.split('.'); + const parts = version.split('.'); if (parts.length < 2 || parts.length > 3) this.throwInvalidVersionFormat(); if (parts.length == 3 && parts[2] !== 'x' && parts[2] !== '*') { this.throwInvalidVersionFormat(); } - let major = this.getVersionNumberOrThrow(parts[0]); - let minor; - if (parts[1] === 'x') { - minor = parts[1]; - } - else { - minor = this.getVersionNumberOrThrow(parts[1]); - } + const major = this.getVersionNumberOrThrow(parts[0]); + const minor = ['x', '*'].includes(parts[1]) ? parts[1] : this.getVersionNumberOrThrow(parts[1]); this.fullversion = major + '.' + minor; } getVersionNumberOrThrow(input) { diff --git a/src/installer.ts b/src/installer.ts index 12113e6..0f3fc42 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -30,7 +30,7 @@ export class DotNetVersionInfo { } //Note: No support for previews when using generic - let parts: string[] = version.split('.'); + const parts: string[] = version.split('.'); if (parts.length < 2 || parts.length > 3) this.throwInvalidVersionFormat(); @@ -38,13 +38,8 @@ export class DotNetVersionInfo { this.throwInvalidVersionFormat(); } - let major = this.getVersionNumberOrThrow(parts[0]); - let minor; - if (parts[1] === 'x') { - minor = parts[1]; - } else { - minor = this.getVersionNumberOrThrow(parts[1]); - } + const major = this.getVersionNumberOrThrow(parts[0]); + const minor = ['x', '*'].includes(parts[1]) ? parts[1] : this.getVersionNumberOrThrow(parts[1]); this.fullversion = major + '.' + minor; }