@beenotung/tslib
Version:
utils library in Typescript
31 lines (30 loc) • 1.21 kB
TypeScript
/**
* @returns true if nsn (digits, no trunk 0) is a whitelisted mobile range; false for landline
* and other NDCs (e.g. 8… for 08, geographic 31…, 40…)
*/
export declare function is_se_mobile_nsn(nsn: string): boolean;
/**
* Short prefix check only. True if the number can start a mobile NDC; false for 08/landline
* (leading 8 after stripping 0). Use to_full_se_mobile_phone or is_se_mobile_nsn for full match.
*/
export declare function is_se_mobile_phone_prefix(tel: string): boolean;
/**
* with/without +46 prefix
*/
export declare function is_se_mobile_phone(tel: number | string): boolean;
/**
* very forgiving
*
* @returns +46 plus NSN if valid (variable length, NO leading 0 after country code in internal form)
* empty string if not valid
*
* Format notes:
* - Local: 070 123 45 67 (or other mobile NDCs; may include trunk 0)
* - Internal: +46 70 123 45 67 (see is_se_mobile_nsn; not landline)
* - Display: format_se_mobile_phone
*/
export declare function to_full_se_mobile_phone(tel: string | number): string;
/**
* @returns +46 xx xxx xx xx if valid (or other layout; variable length)
*/
export declare function format_se_mobile_phone(tel: string | number): string;