/** * Persian/Arabic-Indic digits to ASCII. * * Port of the reference's `Utility::faTOen()`, which every mobile number and * every submitted OTP code passes through before being compared * (henza_server ApiMobileController.php:42,56). The app's numeric keypad emits * Persian digits, so without this a user typing ۱۲۳۴ would never match a stored * 1234 and the phone lookup would miss a registered customer entirely. * * Kept in its own module, free of Nest and Prisma imports, so it can be unit * tested without booting the DI container. */ export function faToEn(input: string): string { return input .replace(/[۰-۹]/g, (d) => String(d.charCodeAt(0) - 0x06f0)) .replace(/[٠-٩]/g, (d) => String(d.charCodeAt(0) - 0x0660)) .trim(); }