π Myanmar Phone Number Validator π²π²
Validate and decode Myanmar phone numbers with ease using this TypeScript library! It's an evolution of the original JavaScript library by Kaung Myat Lwin, now enhanced to fully support TypeScript. π
To install this package, simply run:
npm install myanmar-phone-number-validator
This package offers a myanmarPhoneNumber
object packed with helpful functions:
isValidMMPhoneNumber(phoneNumber: string): boolean
: Verifies if a string is a valid Myanmar phone number, returningtrue
for valid andfalse
for invalid numbers.
import { myanmarPhoneNumber } from 'myanmar-phone-number-validator';
const phoneNumber = '0949880111';
if (myanmarPhoneNumber.isValidMMPhoneNumber(phoneNumber)) {
// It's a valid phone number!
} else {
// Oops, invalid phone number!
}
getTelecomName(phoneNumber: string): string
: Retrieves the name of the telecom operator associated with a phone number, or "Unknown" if it can't be determined.
import { myanmarPhoneNumber } from 'myanmar-phone-number-validator';
const phoneNumber = '0949880111';
const telecomName = myanmarPhoneNumber.getTelecomName(phoneNumber);
getPhoneNetworkType(phoneNumber: string): string
: Determines the network type of a phone number, returning "Unknown" if it can't be determined.
import { myanmarPhoneNumber } from 'myanmar-phone-number-validator';
const phoneNumber = '0949880111';
const networkType = myanmarPhoneNumber.getPhoneNetworkType(phoneNumber);
This project operates under the MIT License.
Huge thanks to Kaung Myat Lwin for creating the original JavaScript library that inspired this one! π