@arctics/google-phonelib
Version:
A JavaScript/TypeScript package providing wrapper for Google's libphonenumber library
25 lines (24 loc) • 799 B
TypeScript
/**
* Class to handle phone number formatting as you type.
*
* This class utilizes the `AsYouTypeFormatter` from the Google's libphonenumber library
* to provide real-time phone number formatting based on the specified region code.
*/
export declare class AsYouTypeHandler {
private formatter;
/**
* Creates an instance of AsYouTypeHandler.
* @param {string} regionCode - The region code for formatting the phone number.
*/
constructor(regionCode: string);
/**
* Formats the phone number as you type.
* @param {string} phoneNumber - The phone number to format.
* @returns {string} - The formatted phone number.
*/
typeNumber(phoneNumber: string): string;
/**
* Clears the input in the formatter.
*/
clearInput(): void;
}