@devmehq/phone-number-validator-js
Version:
Verify phone number, validate format, checking carrier name, geo and timezone infos.
27 lines (26 loc) • 1.28 kB
TypeScript
export * from 'libphonenumber-js';
import { PhoneNumber } from 'libphonenumber-js';
import { CarrierLocale, GeocoderLocale } from './locales';
/**
* Provides geographical information related to the phone number
*
* @param phonenumber The phone number
* @param locale The preferred locale to use (falls back to `en` if there are no localized carrier infos for the given locale)
*/
export declare function geocoder(phonenumber: PhoneNumber | undefined, locale?: GeocoderLocale): string | null;
/**
* Maps the phone number to the original carrier
*
* **Note:** This method cannot provide data about the current carrier of the phone number,
* only the original carrier who is assigned to the corresponding range.
* @see https://github.com/google/libphonenumber#mapping-phone-numbers-to-original-carriers
*
* @param phonenumber The phone number
* @param locale The preferred locale to use (falls back to `en` if there are no localized carrier infos for the given locale)
*/
export declare function carrier(phonenumber: PhoneNumber | undefined, locale?: CarrierLocale): string | null;
/**
* Provides all timezones related to the phone number
* @param phonenumber The phone number
*/
export declare function timezones(phonenumber: PhoneNumber | undefined): string[] | null;