Download wp-calypso/client/components/advanced-credentials/utils.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 380 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/advanced-credentials/utils.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/components/advanced-credentials/utils.ts
-
curl -L -o utils.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/advanced-credentials/utils.ts
380 Bytes
| const getHostMatch = ( host: string ) => { | |
| const urlPattern = /^(https?:\/\/)?([a-zA-Z0-9.-]+)(\/.*)?$/; | |
| return host.match( urlPattern ); | |
| }; | |
| export const getHostInput = ( host: string ) => { | |
| const match = getHostMatch( host ); | |
| return match?.[ 2 ] || ''; | |
| }; | |
| export const checkHostInput = ( host: string ) => { | |
| const match = getHostMatch( host ); | |
| return !! match?.[ 2 ]; | |
| }; | |