import { findCountryByPrefix } from '../findCountryByPrefix'; export interface PhoneNumber { prefix: string | null; suffix: string; format?: string; } /** * @param number Phone number in a format like "+447573135343" */ export const explodeNumberModel = (number: string): PhoneNumber => { const country = findCountryByPrefix(number); return country ? { prefix: country.phone, suffix: number.slice(country.phone.length), format: country.phoneFormat, } : { prefix: null, suffix: number.slice(1), }; };