myanmar-phonenumber
v0.3.3
Published
Javascript module port (for browsers and node) to check valid myanmar mobile numbers, get mobile operator's name, sanitize mobile numbers and get mobile network types.
Downloads
1,120
Maintainers
Readme
Javascript module port (for browsers and node) of mm_phonenumber to check valid myanmar mobile numbers, get mobile operator's name, sanitize mobile numbers and get mobile network types.
Credit: Original script (Python)
Demo: Web Demo
Installation
If you have NPM installed,
npm install myanmar-phonenumber --save
Or if you're using for browser, download it and include in your document as shown below.
For CDN users, include the following URL.
https://unpkg.com/myanmar-phonenumber
Usage
In browser
// this is example script
<script src="path/to/myanmar.phonenumber.js"></script>
<script>
console.log(myanmarPhoneNumber.normalizeInput('+၉၅၉၇၈၄၁၂၃၄၅၆')); // returns 09784123456
console.log(myanmarPhoneNumber.normalizeInput('+959784123456')); // returns 09784123456
console.log(myanmarPhoneNumber.getTelecomName('09978412345')); // returns Ooredoo
console.log(myanmarPhoneNumber.getPhoneNetworkType('09978412345')); // returns GSM
console.log(myanmarPhoneNumber.isValidMMPhoneNumber('09978412345')); // returns true if it meets Myanmar Phone Number conditions
</script>
In Node environment
var myanmarPhoneNumber = require('/path/to/myanmar.phonenumber.js');
console.log(myanmarPhoneNumber.normalizeInput('+၉၅၉၇၈၄၁၂၃၄၅၆')); // returns 09784123456
console.log(myanmarPhoneNumber.normalizeInput('+959784123456')); // returns 09784123456
console.log(myanmarPhoneNumber.getTelecomName('09978412345')); // returns Ooredoo
console.log(myanmarPhoneNumber.getPhoneNetworkType('09978412345')); // returns GSM
console.log(myanmarPhoneNumber.isValidMMPhoneNumber('09978412345')); // returns true if it meets Myanmar Phone Number conditions