1
0
mirror of https://github.com/kremalicious/umami.git synced 2025-01-03 02:25:07 +01:00
umami/lib/url.js

12 lines
241 B
JavaScript
Raw Normal View History

export function removeTrailingSlash(url) {
2020-09-01 05:25:31 +02:00
return url && url.length > 1 && url.endsWith('/') ? url.slice(0, -1) : url;
}
export function getDomainName(str) {
try {
return new URL(str).hostname;
2020-09-01 05:25:31 +02:00
} catch (e) {
return str;
}
}