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 18 | 21x 21x 21x | /**
* Every spelling an Indian number is stored under. Pros and inquiries hold
* E.164 (`+91…`) or bare ten digits; Meta delivers `from` as `91…` with no
* plus; Quick Send stores whatever was typed. Anything that is not a
* recognisable Indian number is returned as-is, so a foreign number can never
* match a pro by its last ten digits.
*/
export function whatsappNumberVariants(phone: string): string[] {
const digits = phone.replace(/\D/g, "");
const national =
digits.length === 10
? digits
: digits.length === 12 && digits.startsWith("91")
? digits.slice(2)
: null;
return national ? [national, `91${national}`, `+91${national}`] : [phone];
}
|