Download wp-calypso/client/hosting/performance/utils.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 694 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/hosting/performance/utils.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/hosting/performance/utils.ts
-
curl -L -o utils.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/hosting/performance/utils.ts
694 Bytes
| import isA8CForAgencies from 'calypso/lib/a8c-for-agencies/is-a8c-for-agencies'; | |
| export function isValidURL( url: string ) { | |
| if ( 'canParse' in URL ) { | |
| return URL.canParse( url ); | |
| } | |
| return /^(https?:\/\/)?((?!false\.)([a-z0-9-]+\.)+)[a-z]{2,}(:[0-9]{1,5})?(\/[^\s]*)?$/i.test( | |
| url | |
| ); | |
| } | |
| // Returns props for the support link based on the current environment | |
| export function getSupportLinkProps() { | |
| return { | |
| showIcon: false, | |
| supportContext: isA8CForAgencies() ? 'a4a-site-performance' : 'site-performance', | |
| showSupportModal: ! isA8CForAgencies(), | |
| supportLink: | |
| isA8CForAgencies() && | |
| 'https://agencieshelp.automattic.com/knowledge-base/check-your-sites-performance', | |
| }; | |
| } | |