@beenotung/tslib
Version:
utils library in Typescript
36 lines (35 loc) • 1.27 kB
TypeScript
/** ******************************
* Japan mobile phone number *
*********************************/
/**
* starts with 070, 080, or 090
* Mobile telephony and data services (PDC, J-CDMA, UMTS)
* reference: https://en.wikipedia.org/wiki/Telephone_numbers_in_Japan
*/
export declare function is_jp_mobile_phone_prefix(tel: string): boolean;
/**
* with/without +81 prefix
*/
export declare function is_jp_mobile_phone(tel: number | string): boolean;
/**
* very forgiving
*
* @returns +81xxxxxxxxxx if valid (10 digits after country code)
* empty string if not valid
*
* Handles all combinations (ordered by specificity - longest first):
* WITH leading 0 (11 digits):
* - Country code +81: +8109012345678 → +819012345678
* - Country code 81 (no +): 8109012345678 → +819012345678
* - No country code: 09012345678 → +819012345678
*
* WITHOUT leading 0 (10 digits):
* - Country code +81: +819012345678 → +819012345678
* - Country code 81 (no +): 819012345678 → +819012345678
* - No country code: 9012345678 → +819012345678
*/
export declare function to_full_jp_mobile_phone(tel: string | number): string;
/**
* @returns +81 90 xxxx xxxx if valid
*/
export declare function format_jp_mobile_phone(tel: string | number): string;