MCPcopy Index your code
hub / github.com/code-pushup/cli / normalizeUrlInput

Function normalizeUrlInput

packages/utils/src/lib/plugin-url-config.ts:22–54  ·  view source on GitHub ↗
(input: PluginUrls)

Source from the content-addressed store, hash-verified

20export const SINGLE_URL_THRESHOLD = 1;
21
22export function normalizeUrlInput(input: PluginUrls): {
23 urls: string[];
24 context: PluginUrlContext;
25} {
26 if (typeof input === 'string') {
27 return {
28 urls: [input],
29 context: {
30 urlCount: 1,
31 weights: { 1: 1 },
32 },
33 };
34 }
35 if (Array.isArray(input)) {
36 return {
37 urls: input,
38 context: {
39 urlCount: input.length,
40 weights: Object.fromEntries(input.map((_, i) => [i + 1, 1])),
41 },
42 };
43 }
44 const entries = Object.entries(input);
45 return {
46 urls: entries.map(([url]) => url),
47 context: {
48 urlCount: entries.length,
49 weights: Object.fromEntries(
50 entries.map(([, weight], i) => [i + 1, weight]),
51 ),
52 },
53 };
54}
55
56export function getUrlIdentifier(url: string): string {
57 try {

Callers 3

lighthousePluginFunction · 0.90
axePluginFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected