Skip to content

Interface: PhoneModel

The PhoneModel interface represents a phone number object with various properties and methods.

Properties

PropertyTypeDescription
countryCountryOrUnknownThe 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.
e164stringThe e164 property represents the phone number as a string in the E.164 format.
internationalstringThe international property represents the phone number as a string in the international format for the parsed country.
mobilebooleanThe 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.
nationalstringThe national property represents the phone number as a string in the national format for the parsed country.
rawstringThe raw property represents the phone number as a string stripped of all non-numeric characters.
timezonePossiblePhoneTimezoneThe 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.
validbooleanThe 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

PhoneModelInstanceObject


toObject()

ts
toObject(): PhoneModelInstanceObject;

The toObject method returns an object with the same properties as the PhoneModelInstanceObject interface.

Returns

PhoneModelInstanceObject


toString()

ts
toString(): string;

The toString method returns the phone number as a string in the international format for the parsed country.

Returns

string