Interface: PhoneModel
The PhoneModel interface represents a phone number object with various properties and methods.
Properties
| Property | Type | Description |
|---|---|---|
country | CountryOrUnknown | The country property represents the country that was used to create the Phone instance. Remarks In cases where the country was not recognized and could not be guessed from the phone number, 'XX' is used. |
e164 | string | The e164 property represents the phone number as a string in the E.164 format. |
international | string | The international property represents the phone number as a string in the international format for the parsed country. |
mobile | boolean | The mobile property represents whether the phone number is possibly a mobile phone number or not. Remarks This property is true if the phone number type is either 'MOBILE' or 'FIXED_LINE_OR_MOBILE'. This covers cases like in the United States and Canada where it is not possible to tell if a phone number is a mobile phone number or not based on the phone number alone. |
national | string | The national property represents the phone number as a string in the national format for the parsed country. |
raw | string | The raw property represents the phone number as a string stripped of all non-numeric characters. |
timezone | PossiblePhoneTimezone | The timezone property represents the estimated timezone of the phone number based on the phone number's country. It can be either a CountryTimezone or 'UTC'. Remarks In cases where the phone number's country has several timezones, the timezone with the greatest population is used. In cases where the phone number's country is not recognized or has no timezone defined, 'UTC' is used. |
type | | "FIXED_LINE" | "MOBILE" | "FIXED_LINE_OR_MOBILE" | "TOLL_FREE" | "PREMIUM_RATE" | "SHARED_COST" | "VOIP" | "PERSONAL_NUMBER" | "PAGER" | "UAN" | "VOICEMAIL" | "UNKNOWN" | "INVALID" | The type property represents the type of the phone number. It can be any of the keys of the PhoneNumberType object in the google-libphonenumber library, or 'INVALID' if the phone number is not valid. |
valid | boolean | The valid property represents whether the phone number uses a valid format for the parsed country or not. |
Methods
toJSON()
ts
toJSON(): PhoneModelInstanceObject;The toJSON method returns an object with the same properties as the PhoneModelInstanceObject interface.
Returns
toObject()
ts
toObject(): PhoneModelInstanceObject;The toObject method returns an object with the same properties as the PhoneModelInstanceObject interface.
Returns
toString()
ts
toString(): string;The toString method returns the phone number as a string in the international format for the parsed country.
Returns
string