UNPKG

@beenotung/tslib

Version:
31 lines (30 loc) 1.19 kB
/** ****************************** * Malaysia mobile phone number * *********************************/ /** * starts with 01x (010, 011, 012, 013, 014, 016, 017, 018, 019) * reference: https://en.wikipedia.org/wiki/Telephone_numbers_in_Malaysia */ export declare function is_my_mobile_phone_prefix(tel: string): boolean; /** * with/without +60 prefix */ export declare function is_my_mobile_phone(tel: number | string): boolean; /** * very forgiving * * @returns +60xxxxxxxxx if valid (9-10 digits after country code) * empty string if not valid * * Format notes: * - Local format: 012 345 6789 (10 digits WITH leading 0) or 011 1234 5678 (11 digits WITH leading 0) - used in Malaysia * - Internal format: +60 12 345 6789 (9-10 digits after +60, NO leading 0) * - Display format: +60 12 345 6789 (formatted by format_my_mobile_phone) */ export declare function to_full_my_mobile_phone(tel: string | number): string; /** * @returns +60 XX XXX XXXX if valid (format varies by length: 9 or 10 digits) * - 9 digits: +60 XX XXX XXXX * - 10 digits: +60 XX XXXX XXXX */ export declare function format_my_mobile_phone(tel: string | number): string;