mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
12 lines
230 B
JavaScript
12 lines
230 B
JavaScript
|
export function removeTrailingSlash(url) {
|
||
|
return url.length > 1 && url.endsWith('/') ? url.slice(0, -1) : url;
|
||
|
}
|
||
|
|
||
|
export function getDomainName(str) {
|
||
|
try {
|
||
|
return new URL(str).hostname;
|
||
|
} catch {
|
||
|
return str;
|
||
|
}
|
||
|
}
|