@beenotung/tslib
Version:
utils library in Typescript
30 lines (29 loc) • 1.06 kB
TypeScript
/** ******************************
* Spain mobile phone number *
*********************************/
/**
* Mobile numbers start with 6xx or 7xx (600-699, 700-799)
* Format: 9 digits total (no leading 0 in local format)
* Reference: https://en.wikipedia.org/wiki/Telephone_numbers_in_Spain
*/
export declare function is_es_mobile_phone_prefix(tel: string): boolean;
/**
* with/without +34 prefix
*/
export declare function is_es_mobile_phone(tel: number | string): boolean;
/**
* very forgiving
*
* @returns +34xxxxxxxxx if valid (9 digits after country code)
* empty string if not valid
*
* Format notes:
* - Local format: 612 345 678 (9 digits, NO leading 0) - used in Spain
* - Internal format: +34 612 345 678 (9 digits after +34)
* - Display format: +34 612 345 678 (formatted by format_es_mobile_phone)
*/
export declare function to_full_es_mobile_phone(tel: string | number): string;
/**
* @returns +34 6xx xxx xxx or +34 7xx xxx xxx if valid
*/
export declare function format_es_mobile_phone(tel: string | number): string;