The Phone
class constructor takes a phone
argument of type RawPhoneType
and an optional country
argument of type RawCountryType
.
It initializes Phone
instance.
The phone number to be parsed and validated.
Optional
country: CountryThe country code of the phone number. If not provided, the country will be guessed based on the phone number.
Returns the country code of the phone number.
Returns the E.164 format of the phone number.
If the phone number is not a valid phone number, the initial phone number which was passed to the constructor is returned.
Returns the international format of the phone number.
If the phone number is not a valid phone number, the initial phone number which was passed to the constructor is returned.
Returns whether the phone number is a mobile number or not.
Returns the national format of the phone number.
If the phone number is not a valid phone number, the initial phone number which was passed to the constructor is returned.
Returns the raw phone number.
If the phone number is not a valid phone number, the initial phone number which was passed to the constructor is returned.
Returns the timezone of the phone number.
Returns the type of the phone number.
Returns whether the phone number uses a valid format for the parsed country or not.
Returns a JSON representation of the phone number.
The country code of the phone number.
In cases where the country was not recognized and could not be guessed from the phone number, 'XX'
is used.
The phone number as a string in the E.164 format.
The phone number as a string in the international format for the parsed country.
Whether the phone number is possibly a mobile number or not.
The phone number as a string in the national format for the parsed country.
The phone number as a string stripped of all non-numeric characters.
The phone number as a string stripped of all non-numeric characters.
The estimated timezone of the phone number based on the phone number's country. It can be either a CountryTimezone
or 'UTC'
.
The type of the phone number.
Whether the phone number uses a valid format for the parsed country or not.
Returns an object representation of the phone number.
The country code of the phone number.
In cases where the country was not recognized and could not be guessed from the phone number, 'XX'
is used.
The phone number as a string in the E.164 format.
The phone number as a string in the international format for the parsed country.
Whether the phone number is possibly a mobile number or not.
The phone number as a string in the national format for the parsed country.
The phone number as a string stripped of all non-numeric characters.
The phone number as a string stripped of all non-numeric characters.
The estimated timezone of the phone number based on the phone number's country. It can be either a CountryTimezone
or 'UTC'
.
The type of the phone number.
Whether the phone number uses a valid format for the parsed country or not.
Static
deserializeCreates a new phone object from a serialized phone object.
The serialized phone object returned from the Phone.serialize
method.
A Phone instance with the same properties as the original phone object.
An error if the serialized phone object is not valid.
The
Phone
class represents a phone number and provides methods to retrieve information about it. It implements thePhoneModel
interface.Implements