Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kaungmyatlwin/myanmar-phonenumber
Javascript module port (for browsers and node) of (https://github.com/Melomap/mm_phonenumber) to check valid myanmar mobile numbers, get mobile operator's name, sanitize mobile numbers and get mobile network types.
https://github.com/kaungmyatlwin/myanmar-phonenumber
javascript mobile-networks mpt myanmar mytel ooredoo phone-number telenor
Last synced: about 2 months ago
JSON representation
Javascript module port (for browsers and node) of (https://github.com/Melomap/mm_phonenumber) to check valid myanmar mobile numbers, get mobile operator's name, sanitize mobile numbers and get mobile network types.
- Host: GitHub
- URL: https://github.com/kaungmyatlwin/myanmar-phonenumber
- Owner: kaungmyatlwin
- License: apache-2.0
- Created: 2017-12-10T17:47:01.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-05-11T06:31:18.000Z (7 months ago)
- Last Synced: 2024-05-20T03:15:08.666Z (7 months ago)
- Topics: javascript, mobile-networks, mpt, myanmar, mytel, ooredoo, phone-number, telenor
- Language: JavaScript
- Homepage:
- Size: 47.9 KB
- Stars: 56
- Watchers: 4
- Forks: 14
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- Awesome-Myanmar - myanmar-phonenumber-js - 2.0) | Javascript module port (for browsers and node) of (https://github.com/Melomap/mm_phonenumber) to check valid myanmar mobile numbers, get mobile operator's name, sanitize mobile numbers and get mobile network types. | (Projects / Component)
README
Javascript module port (for browsers and node) of [mm_phonenumber](https://github.com/Melomap/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)](https://github.com/Melomap/mm_phonenumber)
Demo: [Web Demo](https://kaungmyatlwin.github.io/myanmar-phonenumber)
### Installation
If you have NPM installed,
`npm install myanmar-phonenumber --save`
Or if you're using for browser, [download](https://raw.githubusercontent.com/kaungmyatlwin/myanmar-phonenumber-js/master/myanmar.phonenumber.js) it and include in your document as shown below.
For CDN users, include the following URL.
`https://unpkg.com/myanmar-phonenumber`
### Usage
In browser
```javascript
// this is example scriptconsole.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```
In Node environment
```javascript
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
```### TypeScript
For the usage with TypeScript, refer to [@types/myanmar-phonenumber](https://www.npmjs.com/package/@types/myanmar-phonenumber). Big thanks to [@HtetOoWaiYan](https://github.com/HtetOoWaiYan) for the contribution on DefinitelyTyped repo.