MCPcopy
hub / github.com/darkreader/darkreader / parseURL

Function parseURL

src/utils/url.ts:19–32  ·  view source on GitHub ↗
($url: string, $base: string | null = null)

Source from the content-addressed store, hash-verified

17}
18
19export function parseURL($url: string, $base: string | null = null): URL {
20 const key = `${$url}${$base ? `;${$base}` : ''}`;
21 if (parsedURLCache.has(key)) {
22 return parsedURLCache.get(key)!;
23 }
24 if ($base) {
25 const parsedURL = new URL($url, fixBaseURL($base));
26 parsedURLCache.set(key, parsedURL);
27 return parsedURL;
28 }
29 const parsedURL = new URL(fixBaseURL($url));
30 parsedURLCache.set($url, parsedURL);
31 return parsedURL;
32}
33
34export function getAbsoluteURL($base: string, $relative: string): string {
35 if ($relative.match(/^data\\?\:/)) {

Callers 3

getCSSBaseBathFunction · 0.90
getAbsoluteURLFunction · 0.85

Calls 4

fixBaseURLFunction · 0.85
hasMethod · 0.65
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected