All files / app/address isValidAddress.ts

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11    25x 25x   25x 169x   169x    
import { Address, FormField } from '@bigcommerce/checkout-sdk';
 
import getAddressFormFieldsValidationSchema from './getAddressFormFieldsValidationSchema';
import mapAddressToFormValues from './mapAddressToFormValues';
 
export default function isValidAddress(address: Address, formFields: FormField[]): boolean {
    const addressSchema = getAddressFormFieldsValidationSchema({ formFields });
 
    return addressSchema.isValidSync(mapAddressToFormValues(formFields, address));
}