From 2f2096f65767ea292d3385f71fc881248d02f4d8 Mon Sep 17 00:00:00 2001 From: Nils Andresen Date: Fri, 23 Apr 2021 08:52:53 +0200 Subject: [PATCH] implemented the suggestion to use a moo transform instead of an additional if --- lib/manager/cake/index.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/manager/cake/index.ts b/lib/manager/cake/index.ts index ff632f047d031e..74415c75d33449 100644 --- a/lib/manager/cake/index.ts +++ b/lib/manager/cake/index.ts @@ -19,6 +19,7 @@ const lexerStates = { }, dependencyQuoted: { match: /^#(?:addin|tool|module)\s+"(?:nuget|dotnet):[^"]+"\s*$/, + value: (s: string) => s.trim().slice(1, -1), }, unknown: { match: /[^]/, lineBreaks: true }, }, @@ -26,14 +27,10 @@ const lexerStates = { function parseDependencyLine(line: string): PackageDependency | null { try { - let url = line.replace(/^[^:]*:/, '').trimEnd(); + let url = line.replace(/^[^:]*:/, ''); const isEmptyHost = url.startsWith('?'); url = isEmptyHost ? `http://localhost/${url}` : url; - if (url.endsWith('"')) { - url = url.slice(0, -1); - } - const { origin: registryUrl, protocol, searchParams } = new URL(url); const depName = searchParams.get('package');