lean4-code-actions
Version:
Refactorings and snippets for Lean 4
15 lines (12 loc) • 362 B
text/typescript
/**
* "getDomain", not "getHostname", because "domain" is more common
*/
export function getDomain(url: string) {
return new URL(url).hostname
}
export function getBaseDomainFromHostname(hostname: string) {
return hostname.split('.').slice(-2).join('.')
}
export function getBaseDomain(url: string) {
return getBaseDomainFromHostname(getDomain(url))
}