Mobile Number Parser
const mobileNumberParaser = numbers => numbers.map((number) => {
try {
const phone = phoneUtil.parseAndKeepRawInput(number);
if (!(phoneUtil.isValidNumber(phone) && phoneUtil.isPossibleNumber(phone))) {
throw Error(`Invalid phone number: ${phone}`);
}
return {
region: phoneUtil.getRegionCodeForNumber(phone),
number: phone.getNationalNumber(),
cc: phone.getCountryCode()
};
} catch (e) {
return Error(e);
}
})