Download wp-calypso/client/my-sites/checkout/src/lib/get-postal-code.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 492 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/my-sites/checkout/src/lib/get-postal-code.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/my-sites/checkout/src/lib/get-postal-code.ts
-
curl -L -o get-postal-code.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/my-sites/checkout/src/lib/get-postal-code.ts
492 Bytes
| import { tryToGuessPostalCodeFormat } from '@automattic/wpcom-checkout'; | |
| import type { ManagedContactDetails } from '@automattic/wpcom-checkout'; | |
| export default function getPostalCode( contactDetails: ManagedContactDetails | undefined ): string { | |
| if ( ! contactDetails ) { | |
| return ''; | |
| } | |
| const countryCode = contactDetails.countryCode?.value ?? ''; | |
| const postalCode = contactDetails.postalCode?.value ?? ''; | |
| return tryToGuessPostalCodeFormat( postalCode.toUpperCase(), countryCode ); | |
| } | |