Skip to content

Commit

Permalink
implemented the suggestion to
Browse files Browse the repository at this point in the history
use a moo transform instead of an additional if
  • Loading branch information
nils-a committed Apr 23, 2021
1 parent a2610a2 commit 2f2096f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/manager/cake/index.ts
Expand Up @@ -19,21 +19,18 @@ const lexerStates = {
},
dependencyQuoted: {
match: /^#(?:addin|tool|module)\s+"(?:nuget|dotnet):[^"]+"\s*$/,
value: (s: string) => s.trim().slice(1, -1),
},
unknown: { match: /[^]/, lineBreaks: true },
},
};

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');
Expand Down

0 comments on commit 2f2096f

Please sign in to comment.