File size: 369 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import { getTld } from 'calypso/lib/domains';
export function getRootDomain( domainName: string ): string {
if ( ! domainName ) {
return '';
}
const domainNameParts = domainName.split( '.' );
const tldParts = getTld( domainName ).split( '.' );
const rootDomainParts = domainNameParts.slice( -( tldParts.length + 1 ) );
return rootDomainParts.join( '.' );
}
|