All files / app/address mapAddressFromFormValues.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 12 13 14 15 16 17    24x       24x 19x 19x   19x            
import { Address } from '@bigcommerce/checkout-sdk';
 
import { mapCustomFormFieldsFromFormValues } from '../formFields';
 
import { AddressFormValues } from './mapAddressToFormValues';
 
export default function mapAddressFromFormValues(formValues: AddressFormValues): Address {
    const { customFields, ...address } = formValues;
    const shouldSaveAddress = formValues.shouldSaveAddress;
 
    return {
        ...address,
        shouldSaveAddress,
        customFields: mapCustomFormFieldsFromFormValues(customFields),
    };
}