More compact code

This commit is contained in:
Younes Aassila 2024-03-10 14:34:18 +01:00
parent c891597ac7
commit f53fda0367
2 changed files with 2 additions and 4 deletions

View File

@ -1,7 +1,6 @@
export default function getHostFromUrl(url: string) {
try {
const Url = new URL(url);
return Url.host;
return new URL(url).host;
} catch {
return null;
}

View File

@ -1,7 +1,6 @@
export default function toAbsoluteUrl(url: string): string {
try {
const Url = new URL(url, location.href);
return Url.href;
return new URL(url, location.href).href;
} catch {
return url;
}