phone
- Version 3.1.75
- Published
- 88.4 kB
- No dependencies
- MIT license
Install
npm i phoneyarn add phonepnpm add phoneOverview
With a given country and phone number, validate and format the phone number to E.164 standard
Index
Variables
variable countryPhoneData
const countryPhoneData: { alpha2: string; alpha3: string; country_code: string; country_name: string; mobile_begin_with: string[]; phone_number_lengths: number[];}[];Functions
function phone
phone: ( phoneNumber: string, { country, validateMobilePrefix, strictDetection, }?: { country?: string; validateMobilePrefix?: boolean; strictDetection?: boolean; }) => PhoneResult;{Object} Option {string=} country - country code in ISO3166 alpha 2 or 3 {boolean=} validateMobilePrefix - true to validate phone number prefix {boolean=} strictDetection - true to disable remove truck code and detection logic
Parameter phoneNumber
phone number
Parameter option
Returns
{{phoneNumber: string|null, countryIso2: string|null, countryIso3: string|null}}
Interfaces
interface PhoneInvalidResult
interface PhoneInvalidResult {}property countryCode
countryCode: null;property countryIso2
countryIso2: null;property countryIso3
countryIso3: null;property isValid
isValid: false;property phoneNumber
phoneNumber: null;interface PhoneValidResult
interface PhoneValidResult {}property countryCode
countryCode: string;property countryIso2
countryIso2: string;property countryIso3
countryIso3: string;property isValid
isValid: true;property phoneNumber
phoneNumber: string;Type Aliases
type PhoneResult
type PhoneResult = PhoneInvalidResult | PhoneValidResult;Package Files (2)
Dependencies (0)
No dependencies.
Dev Dependencies (14)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/phone.
- Markdown[](https://www.jsdocs.io/package/phone)
- HTML<a href="https://www.jsdocs.io/package/phone"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 1831 ms. - Missing or incorrect documentation? Open an issue for this package.
