@beenotung/tslib
Version:
utils library in Typescript
30 lines (29 loc) • 1.14 kB
TypeScript
/** ******************************
* Germany mobile phone number *
*********************************/
/**
* Mobile numbers start with 015, 016, or 017
* Format: 0AA BBB BBBB (variable length with leading 0 in local format)
* Reference: https://en.wikipedia.org/wiki/Telephone_numbers_in_Germany
*/
export declare function is_de_mobile_phone_prefix(tel: string): boolean;
/**
* with/without +49 prefix
*/
export declare function is_de_mobile_phone(tel: number | string): boolean;
/**
* very forgiving
*
* @returns +49xxxxxxxxx if valid (variable length after country code, NO leading 0 in internal format)
* empty string if not valid
*
* Format notes:
* - Local format: 0151 12345678 (variable length WITH leading 0) - used in Germany
* - Internal format: +49 151 12345678 (variable length after +49, NO leading 0)
* - Display format: +49 151 12345678 (formatted by format_de_mobile_phone)
*/
export declare function to_full_de_mobile_phone(tel: string | number): string;
/**
* @returns +49 15x xxx xxxx if valid (or similar format)
*/
export declare function format_de_mobile_phone(tel: string | number): string;