($url: string, $base: string | null = null)
| 17 | } |
| 18 | |
| 19 | export 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 | |
| 34 | export function getAbsoluteURL($base: string, $relative: string): string { |
| 35 | if ($relative.match(/^data\\?\:/)) { |
no test coverage detected