UNPKG

@beenotung/tslib

Version:
32 lines (31 loc) 1.16 kB
/** ****************************** * Indonesia mobile phone number * *********************************/ /** * starts with 08 * reference: https://en.wikipedia.org/wiki/Telephone_numbers_in_Indonesia */ export declare function is_id_mobile_phone_prefix(tel: string): boolean; /** * with/without +62 prefix */ export declare function is_id_mobile_phone(tel: number | string): boolean; /** * very forgiving * * @returns +62xxxxxxxxxx if valid (9-11 digits after country code, typically 10-11) * empty string if not valid * * Format notes: * - Local format: 0812 3456 789 (10-12 digits WITH leading 0) - used in Indonesia * - Internal format: +62 812 3456 789 (9-11 digits after +62, NO leading 0) * - Display format: +62 812 3456 789 (formatted by format_id_mobile_phone) */ export declare function to_full_id_mobile_phone(tel: string | number): string; /** * @returns +62 8xx xxx xxx if valid (format varies by length: 9-11 digits) * - 9 digits: +62 8xx xxx xxx * - 10 digits: +62 8xx xxxx xxx * - 11 digits: +62 8xx xxxx xxxx */ export declare function format_id_mobile_phone(tel: string | number): string;