Interface: Phone
The Phone class represents a phone number and provides methods to retrieve information about it. It implements the PhoneModel interface.
Implements
Implements
PhoneModel
Properties
Methods
inspect()
ts
inspect(): string;Returns a stringified representation of the phone number.
Returns
string
- A string representation of the phone number.
serialize()
ts
serialize(): string;Serializes the phone object to an obfuscated string which can be used to recreate the phone object from the Phone.deserialize method.
Returns
string
- The serialized phone object.
toJSON()
ts
toJSON(): {
country: CountryOrUnknown;
e164: string;
international: string;
mobile: boolean;
national: string;
phone: string;
raw: string;
timezone: PossiblePhoneTimezone;
type: | "FIXED_LINE"
| "MOBILE"
| "FIXED_LINE_OR_MOBILE"
| "TOLL_FREE"
| "PREMIUM_RATE"
| "SHARED_COST"
| "VOIP"
| "PERSONAL_NUMBER"
| "PAGER"
| "UAN"
| "VOICEMAIL"
| "UNKNOWN"
| "INVALID";
valid: boolean;
};Returns a JSON representation of the phone number.
Returns
- A JSON-safe representation of the phone number.
| Name | Type | Description |
|---|---|---|
country | CountryOrUnknown | The country code of the phone number. Remarks In cases where the country was not recognized and could not be guessed from the phone number, 'XX' is used. |
e164 | string | The phone number as a string in the E.164 format. |
international | string | The phone number as a string in the international format for the parsed country. |
mobile | boolean | Whether the phone number is possibly a mobile number or not. |
national | string | The phone number as a string in the national format for the parsed country. |
phone | string | The phone number as a string stripped of all non-numeric characters. |
raw | string | The phone number as a string stripped of all non-numeric characters. |
timezone | PossiblePhoneTimezone | The estimated timezone of the phone number based on the phone number's country. It can be either a CountryTimezone or 'UTC'. |
type | | "FIXED_LINE" | "MOBILE" | "FIXED_LINE_OR_MOBILE" | "TOLL_FREE" | "PREMIUM_RATE" | "SHARED_COST" | "VOIP" | "PERSONAL_NUMBER" | "PAGER" | "UAN" | "VOICEMAIL" | "UNKNOWN" | "INVALID" | The type of the phone number. |
valid | boolean | Whether the phone number uses a valid format for the parsed country or not. |
Implementation of
ts
PhoneModel.toJSON;toObject()
ts
toObject(): {
country: CountryOrUnknown;
e164: string;
international: string;
mobile: boolean;
national: string;
phone: string;
raw: string;
timezone: PossiblePhoneTimezone;
type: | "FIXED_LINE"
| "MOBILE"
| "FIXED_LINE_OR_MOBILE"
| "TOLL_FREE"
| "PREMIUM_RATE"
| "SHARED_COST"
| "VOIP"
| "PERSONAL_NUMBER"
| "PAGER"
| "UAN"
| "VOICEMAIL"
| "UNKNOWN"
| "INVALID";
valid: boolean;
};Returns an object representation of the phone number.
Returns
- An object representation of the phone number.
| Name | Type | Description |
|---|---|---|
country | CountryOrUnknown | The country code of the phone number. Remarks In cases where the country was not recognized and could not be guessed from the phone number, 'XX' is used. |
e164 | string | The phone number as a string in the E.164 format. |
international | string | The phone number as a string in the international format for the parsed country. |
mobile | boolean | Whether the phone number is possibly a mobile number or not. |
national | string | The phone number as a string in the national format for the parsed country. |
phone | string | The phone number as a string stripped of all non-numeric characters. |
raw | string | The phone number as a string stripped of all non-numeric characters. |
timezone | PossiblePhoneTimezone | The estimated timezone of the phone number based on the phone number's country. It can be either a CountryTimezone or 'UTC'. |
type | | "FIXED_LINE" | "MOBILE" | "FIXED_LINE_OR_MOBILE" | "TOLL_FREE" | "PREMIUM_RATE" | "SHARED_COST" | "VOIP" | "PERSONAL_NUMBER" | "PAGER" | "UAN" | "VOICEMAIL" | "UNKNOWN" | "INVALID" | The type of the phone number. |
valid | boolean | Whether the phone number uses a valid format for the parsed country or not. |
Implementation of
ts
PhoneModel.toObject;toString()
ts
toString(): string;Returns the E.164 format of the phone number as a string.
Returns
string
- The E.164 format of the phone number.
Implementation of
ts
PhoneModel.toString;