import { CountryCode } from "libphonenumber-js"; import { Country } from "@/components/PhoneInput/types"; import countryOptionsDataMap from "@/components/PhoneInput/utils/countryOptionsDataMap"; import getPhoneMask from "@/components/PhoneInput/utils/getPhoneMask"; type InitialDataFromValue = { country: Country; format: ReturnType; }; const getInitialDataFromValue = ( initialCountryCode: string ): InitialDataFromValue => { return { country: countryOptionsDataMap[initialCountryCode], format: getPhoneMask(initialCountryCode as CountryCode), }; }; export default getInitialDataFromValue;