UNPKG

@beenotung/tslib

Version:
30 lines (29 loc) 1.15 kB
/** ****************************** * Switzerland mobile phone number * *********************************/ /** * Mobile numbers start with 07x (074, 075, 076, 077, 078, 079) * Format: 0AA BBB BB BB (10 digits with leading 0 in local format) * Reference: https://en.wikipedia.org/wiki/Telephone_numbers_in_Switzerland */ export declare function is_ch_mobile_phone_prefix(tel: string): boolean; /** * with/without +41 prefix */ export declare function is_ch_mobile_phone(tel: number | string): boolean; /** * very forgiving * * @returns +41xxxxxxxxx if valid (9 digits after country code, NO leading 0 in internal format) * empty string if not valid * * Format notes: * - Local format: 079 123 45 67 (10 digits WITH leading 0) - used in Switzerland * - Internal format: +41 79 123 45 67 (9 digits after +41, NO leading 0) - always 9 digits * - Display format: +41 79 123 45 67 (formatted by format_ch_mobile_phone) */ export declare function to_full_ch_mobile_phone(tel: string | number): string; /** * @returns +41 7x xxx xx xx if valid */ export declare function format_ch_mobile_phone(tel: string | number): string;