From 1c48dc5a9ea481b0befae42489e0be5be5a17ad2 Mon Sep 17 00:00:00 2001 From: Jef LeCompte Date: Thu, 30 Jun 2022 09:22:35 -0700 Subject: [PATCH] chore: trim no matter what --- dist/setup/index.js | 5 +---- src/installer.ts | 5 ++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 0a98b4d..67c1d96 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -71768,13 +71768,10 @@ function translateArchToDistUrl(arch) { } } function parseNodeVersionFile(contents) { - let nodeVersion; + let nodeVersion = contents.trim(); if (contents.includes('volta')) { nodeVersion = JSON.parse(contents).volta.node; } - else { - nodeVersion = contents.trim(); - } if (/^v\d/.test(nodeVersion)) { nodeVersion = nodeVersion.substring(1); } diff --git a/src/installer.ts b/src/installer.ts index c9fd0d2..a56b20a 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -495,17 +495,16 @@ function translateArchToDistUrl(arch: string): string { } export function parseNodeVersionFile(contents: string): string { - let nodeVersion; + let nodeVersion = contents.trim(); if (contents.includes('volta')) { nodeVersion = JSON.parse(contents).volta.node; - } else { - nodeVersion = contents.trim(); } if (/^v\d/.test(nodeVersion)) { nodeVersion = nodeVersion.substring(1); } + return nodeVersion; }