Files
100kmph_web/web/lib/phone.ts
T
2026-09-28 23:15:47 +05:30

8 lines
303 B
TypeScript

/** Digits only. Drops a leading 0 or 91 so the same mobile is one customer. */
export function normalizePhone(raw: string): string {
let d = raw.replace(/\D/g, "");
if (d.length === 12 && d.startsWith("91")) d = d.slice(2);
if (d.length === 11 && d.startsWith("0")) d = d.slice(1);
return d;
}