npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mm-phone-validator

v1.0.2

Published

Validate Myanmar phone numbers, detect operator (MPT, Ooredoo, ATOM/Telenor, MyTel, MecTel) and network type. Supports Myanmar numerals, +95 country code, spaces and dashes. Zero dependencies.

Readme

myanmar-phone-validator 🇲🇲

Validate Myanmar phone numbers and auto-detect the operator (MPT, Ooredoo, ATOM, MyTel, MecTel) + network type. Zero dependencies. Works with ESM, CommonJS, browsers, and TypeScript.

⚠️ MNP note: Prefixes indicate the originally allocated operator — a ported number may now belong to a different network.


✨ Features

  • ✅ Phone number validation (modern 11-digit + legacy short numbers)
  • 📡 Auto operator detection: MPT · Ooredoo · ATOM · MyTel · MecTel
  • 📶 Network type: GSM / WCDMA / CDMA 450 / CDMA 800 / CDMA
  • 🔢 Myanmar digits (၀-၉), +95 country code, spaces and dashes supported
  • 📦 Dual ESM + CommonJS + TypeScript types, zero dependencies

📦 Install

npm install myanmar-phone-validator

🚀 Usage

ESM (import)

import {
  isValidMMPhoneNumber,
  getOperator,
  validate,
} from 'myanmar-phone-validator';

isValidMMPhoneNumber('09977123456');      // true
isValidMMPhoneNumber('+959977123456');    // true
isValidMMPhoneNumber('၀၉၉၇၇၁၂၃၄၅၆');      // true (Myanmar digits)

getOperator('09977123456'); // 'Ooredoo'
getOperator('09777123456'); // 'ATOM'
getOperator('09677123456'); // 'MyTel'
getOperator('09421123456'); // 'MPT'

validate('09977123456');
// {
//   valid: true,
//   normalized: '09977123456',
//   international: '+959977123456',
//   operator: 'Ooredoo',
//   networkType: 'GSM'
// }

CommonJS (require)

const { getOperator, isValid } = require('myanmar-phone-validator');

getOperator('09777123456'); // 'ATOM'
isValid('09421123456');     // true

Browser

<script type="module">
  import { getOperator } from './src/index.js';
  console.log(getOperator('09977123456')); // 'Ooredoo'
</script>

Full-result API

import myanmarPhoneValidator from 'myanmar-phone-validator';

myanmarPhoneValidator.getTelecomName('09777123456');      // 'Telenor' (legacy name)
myanmarPhoneValidator.getPhoneNetworkType('09421123456'); // 'GSM' | 'WCDMA' | ...
myanmarPhoneValidator.formatInternational('09977123456'); // '+959977123456'
myanmarPhoneValidator.isValidMMPhoneNumber('123');        // false

📖 API Reference

| Function | Description | |---|---| | isValidMMPhoneNumber(n, { strict }) | Format validation. strict: true also requires a known operator | | isValidMyanmarPhone, isValid, isValidPhoneNumber | Aliases of the above | | getOperator(n) | 'MPT' \| 'Ooredoo' \| 'ATOM' \| 'MyTel' \| 'MecTel' \| 'Unknown' | | getTelecomName(n) | Legacy names: 'Telenor' for ATOM, 'MEC' for MecTel (drop-in compatible with myanmar-phonenumber) | | getPhoneNetworkType(n) / getNetworkType(n) | 'GSM' \| 'WCDMA' \| 'CDMA 450 MHz' \| 'CDMA 800 MHz' \| 'CDMA' \| 'Unknown' | | normalizeInput(n) / normalize(n) | Convert any supported input to 09… national form | | sanitizeInput(n) / sanitize(n) | Trim, convert Myanmar digits to English, strip separators | | formatNational(n) | Normalized 09…, or '' if invalid | | formatInternational(n) | +95…, or '' if invalid | | validate(n) | { valid, normalized, international, operator, networkType } | | isMpt / isOoredoo / isAtom / isTelenor / isMytel / isMecTel / isMec | Boolean helpers | | OPERATORS, NETWORK_TYPES | Constants |


📡 Operator prefixes

Normalized 09… form:

| Operator | Pattern | Example | |---|---|---| | Ooredoo | 0994–0999, 11 digits | 09977123456 | | ATOM (ex-Telenor) | 0974–0979, 11 digits | 09777123456 | | MyTel | 0965–0969, 11 digits | 09677123456 | | MecTel | 09340 / 09346 / 09349, 11 digits | 09340123456 | | MPT | Legacy ranges: 092…, 094…, 095…, CDMA 093… / 098…, WCDMA… | 09421123456 | | Unknown | Valid format but unallocated prefix | — |

General validity = 09 + 7–9 digits (9–11 digits total) — covers old CDMA short numbers through modern 11-digit GSM numbers.


✍️ Accepted input formats

  • 09XXXXXXXXX — e.g. 09977123456
  • 959XXXXXXXXX / +959XXXXXXXXX — e.g. +959977123456
  • 00959XXXXXXXXX
  • Missing trunk zero — 9977123456 → 09977123456
  • Separators ignored — 09-977 123 456, 09.977.123.456, (09) 977123456
  • Myanmar numerals — ၀၉၉၇၇၁၂၃၄၅၆

🧪 Try it / Test page

No server needed — just double-click:

test-page.html

Single-number live check + batch test (one number per line) + API cheat sheet.


🔄 Migration from myanmar-phonenumber

// before
import myanmarPhoneNumber from 'myanmar-phonenumber';
myanmarPhoneNumber.getTelecomName(n);

// after — same function names still work
import { getTelecomName, isValidMMPhoneNumber } from 'myanmar-phone-validator';

Differences / fixes vs the old lib:

  • getOperator() returns canonical 'ATOM' / 'MecTel' — use getTelecomName() for legacy 'Telenor' / 'MEC'.
  • Fixed bug where MyTel / MecTel numbers were misclassified as MPT.
  • sanitizeInput no longer throws on empty input (returns '').
  • Added validate(), formatInternational(), formatNational(), { strict } mode, boolean helpers, TypeScript types, dual ESM + CJS.

💻 Development

npm test              # run tests
npm run test:verbose  # detailed output
node examples/usage.mjs
npm pack --dry-run    # check publish files

🚀 Publish to NPM

npm login
npm publish --access public

Before publishing, fill in package.json: author, repository.url, bugs.url, homepage.


⚖️ License

MIT — see LICENSE.