Download wp-calypso/client/lib/domains/utils/get-root-domain.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 369 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/lib/domains/utils/get-root-domain.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/lib/domains/utils/get-root-domain.ts
-
curl -L -o get-root-domain.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/lib/domains/utils/get-root-domain.ts
369 Bytes
| 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( '.' ); | |
| } | |