Download wp-calypso/client/lib/domains/get-wpcom-domain.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 732 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/lib/domains/get-wpcom-domain.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/lib/domains/get-wpcom-domain.js
-
curl -L -o get-wpcom-domain.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/lib/domains/get-wpcom-domain.js
732 Bytes
| import { type as domainTypes } from './constants'; | |
| export function getWpcomDomain( domainObjects ) { | |
| const wpcomDomainObjects = domainObjects.filter( isWpcomDomain ); | |
| if ( wpcomDomainObjects.length === 0 ) { | |
| return null; | |
| } | |
| // If there are .wpcomstaging and .wordpress domains, give preference to the .wpcomstaging one | |
| const wpcomStagingDomainObject = wpcomDomainObjects.filter( isWpcomStagingDomain ); | |
| if ( wpcomStagingDomainObject.length > 0 ) { | |
| return wpcomStagingDomainObject[ 0 ]; | |
| } | |
| return wpcomDomainObjects[ 0 ]; | |
| } | |
| function isWpcomDomain( domainObject ) { | |
| return domainObject.type === domainTypes.WPCOM; | |
| } | |
| function isWpcomStagingDomain( { domain = '' } ) { | |
| return domain.endsWith( '.wpcomstaging.com' ); | |
| } | |