showing results for - "mobile number parser"
Lia
16 Oct 2018
1const mobileNumberParaser = numbers => numbers.map((number) => {
2  try {
3   const phone = phoneUtil.parseAndKeepRawInput(number);
4   if (!(phoneUtil.isValidNumber(phone) && phoneUtil.isPossibleNumber(phone))) {
5    throw Error(`Invalid phone number: ${phone}`);
6   }
7
8   return {
9    region: phoneUtil.getRegionCodeForNumber(phone),
10    number: phone.getNationalNumber(),
11    cc: phone.getCountryCode()
12   };
13  } catch (e) {
14   return Error(e);
15  }
16 })
17
queries leading to this page
mobile number parsermobile number parser