@beenotung/tslib
Version:
utils library in Typescript
30 lines (29 loc) • 1.11 kB
TypeScript
/** ******************************
* Italy mobile phone number *
*********************************/
/**
* Mobile numbers start with 3xx (300-399)
* Format: 0AA BBB BBBB (variable length with leading 0 in local format)
* Reference: https://en.wikipedia.org/wiki/Telephone_numbers_in_Italy
*/
export declare function is_it_mobile_phone_prefix(tel: string): boolean;
/**
* with/without +39 prefix
*/
export declare function is_it_mobile_phone(tel: number | string): boolean;
/**
* very forgiving
*
* @returns +39xxxxxxxxx if valid (variable length after country code, NO leading 0 in internal format)
* empty string if not valid
*
* Format notes:
* - Local format: 0312 3456789 (variable length WITH leading 0) - used in Italy
* - Internal format: +39 312 3456789 (variable length after +39, NO leading 0)
* - Display format: +39 312 3456789 (formatted by format_it_mobile_phone)
*/
export declare function to_full_it_mobile_phone(tel: string | number): string;
/**
* @returns +39 3xx xxx xxxx if valid
*/
export declare function format_it_mobile_phone(tel: string | number): string;