Download wp-calypso/client/lib/domains/is-subdomain.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 410 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/lib/domains/is-subdomain.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/lib/domains/is-subdomain.ts
-
curl -L -o is-subdomain.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/lib/domains/is-subdomain.ts
410 Bytes
| import { getRootDomain } from 'calypso/lib/domains/utils'; | |
| export function isSubdomain( domainName: string ): boolean { | |
| if ( ! domainName || domainName === '' ) { | |
| return false; | |
| } | |
| const isValidSubdomain = Boolean( | |
| domainName.match( | |
| /^([a-z0-9_]([a-z0-9\-_]*[a-z0-9_])?\.)+[a-z0-9]([a-z0-9-]*[a-z0-9])?\.[a-z]{2,63}$/ | |
| ) | |
| ); | |
| return isValidSubdomain && getRootDomain( domainName ) !== domainName; | |
| } | |