Skip to content

@nhtio/phone-object

An immutable data structure representing a specific phone number and accompanying methods.

Classes

ClassDescription
PhoneThe Phone class represents a phone number and provides methods to retrieve information about it. It implements the PhoneModel interface.

Interfaces

InterfaceDescription
AreaCodeMapAn interface describing an object where a NANPA area code is a key, and a NANPA country code is a value.
PhoneModelThe PhoneModel interface represents a phone number object with various properties and methods.
PhoneModelInstanceObjectThe PhoneModelInstanceObject interface represents the properties of a Phone instance.
SpecificTimeAdvancedOptionsInterface representing advanced options for specifying a specific time for use with the getCountriesWithSpecificTime function.

Type Aliases

Type AliasDescription
CountryRepresents the ISO 3166-1 alpha-2 country codes of all countries recognized by the library.
CountryOrUnknownRepresents either the ISO 3166-1 alpha-2 country codes of all countries recognized by the library or the string 'XX' to represent an unknown country.
CountryTimezoneRepresents the possible timezones of all countries recognized by the library.
NumericRepresents a numeric value that can be either a string or a number.
PhoneTypesThe PhoneTypes type represents the possible types of a 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.
PossiblePhoneTimezoneThe PossiblePhoneTimezone type represents the estimated timezone of a phone number based on the phone number's country. It can be either a CountryTimezone or 'UTC'.
RawCountryTypeThe RawCountryType type represents the country which should be used to parse the phone number. It is of type Country.
RawPhoneTypeThe RawPhoneType type represents the phone number which should be parsed. It can be either a string or a number.

Variables

VariableDescription
areaCodeMapA map of NANPA area codes to NANPA country codes.
countriesAn immutable map of all of the names of the countries recognized by the library in English using ISO 3166-1 alpha-2 country codes as keys.
isosAn immutable set of all of the ISO 3166-1 alpha-2 country codes recognized by the library.
nanpaCountriesA list of NANPA country codes.
PhoneTypesThe PhoneTypes type represents the possible types of a 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.
timezonesAn immutable map of all of the timezones of the countries recognized by the library using ISO 3166-1 alpha-2 country codes as keys.
versionThe current version of the package.

Functions

FunctionDescription
getCountriesWithSpecificTimeReturns an array of ISO 3166-1 alpha-2 country codes that have the same specific time as the given options.