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) { export default function getHostFromUrl(url: string) {
try { try {
const Url = new URL(url); return new URL(url).host;
return Url.host;
} catch { } catch {
return null; return null;
} }

View File

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