From 224204e75c39b6b1feac82a39a9b0ce53d291605 Mon Sep 17 00:00:00 2001 From: IvanZosimov Date: Thu, 18 Aug 2022 16:29:54 +0200 Subject: [PATCH] Simplify resolveVersionInput() --- dist/index.js | 11 +++-------- src/installer.ts | 10 +++------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/dist/index.js b/dist/index.js index 08aaba40f0..61b535ff31 100644 --- a/dist/index.js +++ b/dist/index.js @@ -222,14 +222,9 @@ class DotnetVersionResolver { else { this.resolvedArgument.type = 'channel'; this.resolvedArgument.qualityFlag = true; - if (semver_1.default.validRange(this.inputVersion)) { - let coercedVersion = semver_1.default.coerce(this.inputVersion); - this.resolvedArgument.value = - (coercedVersion === null || coercedVersion === void 0 ? void 0 : coercedVersion.major) + '.' + (coercedVersion === null || coercedVersion === void 0 ? void 0 : coercedVersion.minor); - } - else { - this.resolvedArgument.value = this.inputVersion; - } + let coercedVersion = semver_1.default.coerce(this.inputVersion); + this.resolvedArgument.value = + (coercedVersion === null || coercedVersion === void 0 ? void 0 : coercedVersion.major) + '.' + (coercedVersion === null || coercedVersion === void 0 ? void 0 : coercedVersion.minor); } } createVersionObject() { diff --git a/src/installer.ts b/src/installer.ts index 0e6c1d7d93..fdf67029f1 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -54,13 +54,9 @@ export class DotnetVersionResolver { } else { this.resolvedArgument.type = 'channel'; this.resolvedArgument.qualityFlag = true; - if (semver.validRange(this.inputVersion)) { - let coercedVersion = semver.coerce(this.inputVersion); - this.resolvedArgument.value = - coercedVersion?.major + '.' + coercedVersion?.minor; - } else { - this.resolvedArgument.value = this.inputVersion; - } + let coercedVersion = semver.coerce(this.inputVersion); + this.resolvedArgument.value = + coercedVersion?.major + '.' + coercedVersion?.minor; } }