@beenotung/tslib
Version:
utils library in Typescript
25 lines (24 loc) • 876 B
TypeScript
/** **************************
* China mobile phone number *
*****************************/
/**
* starts with 1, second digit is 3, 4, 5, 6, 7, 8, or 9
* reference: https://en.wikipedia.org/wiki/Telephone_numbers_in_China
*/
export declare function is_cn_mobile_phone_prefix(tel: string): boolean;
/**
* with/without +86 prefix
*/
export declare function is_cn_mobile_phone(tel: number | string): boolean;
/**
* @returns +86xxxxxxxxxx if valid
* empty string if not valid
*
* should be 1xx-XXXX-XXXX (except for 140–144, which are 13-digit IoT numbers)
* in which the first three digits (13x to 19x) designate the mobile phone service provider.
*/
export declare function to_full_cn_mobile_phone(tel: string | number): string;
/**
* @returns +86 1nn xxxx xxxx if valid
*/
export declare function format_cn_mobile_phone(tel: string | number): string;