{"_id":"@diwaskhatri/nepal-phone","_rev":"2-eb84157222c81d55f72ab0499d41c09a","name":"@diwaskhatri/nepal-phone","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@diwaskhatri/nepal-phone","version":"1.0.0","keywords":["nepal","nepali","phone","mobile","validator","telephone","javascript","typescript"],"author":{"url":"https://github.com/DiwasKhatri07","name":"Diwas Khatri"},"license":"MIT","_id":"@diwaskhatri/nepal-phone@1.0.0","maintainers":[{"name":"diwaskhatri","email":"diwaskhatri935@gmail.com"}],"homepage":"https://github.com/DiwasKhatri07/nepal-phone#readme","bugs":{"url":"https://github.com/DiwasKhatri07/nepal-phone/issues"},"dist":{"shasum":"03bc3b5b31dfaf9de50938f35de955a05a487994","tarball":"https://registry.npmjs.org/@diwaskhatri/nepal-phone/-/nepal-phone-1.0.0.tgz","fileCount":6,"integrity":"sha512-wNRbuuCuWmOOIbUY8aIGth+lk1TT6L4nda2elj1JBvrJQaJVoAE26tsD8ZXLMSn2o2k0jvsD6Q6m6jhdVz+9rw==","signatures":[{"sig":"MEUCIQDk3MNbN11p9dIuy1HuRG5oZbMZEOQ8OjdOOHS8dLDDcgIgG200pI9dcKqVDKMb2V+NuzfC12G7JdK7NTazGirA1r8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9276},"main":"./src/index.js","type":"module","types":"./src/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./src/index.d.ts","import":"./src/index.js"}},"funding":{"url":"https://ko-fi.com/diwaskhatri","type":"ko-fi"},"gitHead":"fbc1a0db4fabcc078777a07e24d63af90b6a82a1","scripts":{"test":"node --test","check":"npm test && npm pack --dry-run","test:watch":"node --test --watch"},"_npmUser":{"name":"diwaskhatri","email":"diwaskhatri935@gmail.com"},"repository":{"url":"git+https://github.com/DiwasKhatri07/nepal-phone.git","type":"git"},"_npmVersion":"10.9.2","description":"A tiny, dependency-free JavaScript toolkit for validating, normalizing, and formatting Nepali mobile numbers.","directories":{},"_nodeVersion":"22.13.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/nepal-phone_1.0.0_1788840583837_0.25945839508120017","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@diwaskhatri/nepal-phone","version":"1.1.0","description":"A tiny, dependency-free JavaScript toolkit for validating, normalizing, and formatting Nepali mobile numbers.","type":"module","license":"MIT","author":{"name":"Diwas Khatri","url":"https://github.com/DiwasKhatri07"},"homepage":"https://github.com/DiwasKhatri07/nepal-phone#readme","repository":{"type":"git","url":"git+https://github.com/DiwasKhatri07/nepal-phone.git"},"bugs":{"url":"https://github.com/DiwasKhatri07/nepal-phone/issues"},"funding":{"type":"ko-fi","url":"https://ko-fi.com/diwaskhatri"},"keywords":["nepal","nepali","phone","mobile","validator","telephone","javascript","typescript"],"exports":{".":{"types":"./src/index.d.ts","import":"./src/index.js"}},"main":"./src/index.js","types":"./src/index.d.ts","scripts":{"test":"node --test test/index.test.js","test:watch":"node --test --watch","check":"npm test && npm pack --dry-run","test:jest":"node --experimental-vm-modules node_modules/jest/bin/jest.js"},"engines":{"node":">=18"},"devDependencies":{"jest":"^30.1.3"},"_id":"@diwaskhatri/nepal-phone@1.1.0","gitHead":"e9c39aa1e0f3c5bb3791d64d18be7c3158abed81","_nodeVersion":"22.13.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-lyoXKSG/hW2MZyhBhFeQbg5vCnzAXmtwCVOVxM5E4LGFeMbSYL3apr3vjZ4qVeDp1s87/j4kJxC8CzITs/+/DQ==","shasum":"ebe5db6a9e6b8793882da073e58c942bae7f8c88","tarball":"https://registry.npmjs.org/@diwaskhatri/nepal-phone/-/nepal-phone-1.1.0.tgz","fileCount":6,"unpackedSize":10747,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHQaPSyLWK7GkGYobHdvkgf0a+wj+BHUN1YXlPdxBjqzAiAPmbBklRjfmEMFRFoYcgXVnXPgDrAo8ng9059DIj1E9A=="}]},"_npmUser":{"name":"diwaskhatri","email":"diwaskhatri935@gmail.com"},"directories":{},"maintainers":[{"name":"diwaskhatri","email":"diwaskhatri935@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nepal-phone_1.1.0_1788840747587_0.7672361028940955"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-08T04:09:43.676Z","modified":"2026-09-08T04:12:27.881Z","1.0.0":"2026-09-08T04:09:43.975Z","1.1.0":"2026-09-08T04:12:27.739Z"},"bugs":{"url":"https://github.com/DiwasKhatri07/nepal-phone/issues"},"author":{"name":"Diwas Khatri","url":"https://github.com/DiwasKhatri07"},"license":"MIT","homepage":"https://github.com/DiwasKhatri07/nepal-phone#readme","keywords":["nepal","nepali","phone","mobile","validator","telephone","javascript","typescript"],"repository":{"type":"git","url":"git+https://github.com/DiwasKhatri07/nepal-phone.git"},"description":"A tiny, dependency-free JavaScript toolkit for validating, normalizing, and formatting Nepali mobile numbers.","maintainers":[{"name":"diwaskhatri","email":"diwaskhatri935@gmail.com"}],"readme":"# Nepal Phone\n\n<div align=\"center\">\n  <img src=\"./assets/nepal-phone-banner.svg\" alt=\"Nepal Phone banner\" width=\"900\" />\n  <p><strong>Simple, dependable Nepali mobile-number utilities for JavaScript.</strong></p>\n  <p>\n    <a href=\"https://www.npmjs.com/package/@diwaskhatri/nepal-phone\"><img src=\"https://img.shields.io/npm/v/@diwaskhatri/nepal-phone?style=flat-square&color=dc143c&label=npm\" alt=\"npm version\" /></a>\n    <a href=\"https://github.com/DiwasKhatri07/nepal-phone/actions\"><img src=\"https://img.shields.io/github/actions/workflow/status/DiwasKhatri07/nepal-phone/test.yml?style=flat-square&label=tests\" alt=\"tests\" /></a>\n    <a href=\"https://github.com/DiwasKhatri07/nepal-phone/blob/main/LICENSE\"><img src=\"https://img.shields.io/github/license/DiwasKhatri07/nepal-phone?style=flat-square\" alt=\"MIT license\" /></a>\n  </p>\n</div>\n\n## Why Nepal Phone?\n\nNepali numbers are commonly written in local, international, and human-friendly formats. **Nepal Phone** gives your forms and applications one tiny, dependency-free toolkit for normalizing, validating, and formatting Nepali mobile numbers.\n\nBuilt with care in Nepal by [Diwas Khatri](https://github.com/DiwasKhatri07).\n\n## Highlights\n\n- Zero runtime dependencies\n- Works with Node.js 18+\n- ESM-first and TypeScript declaration included\n- Accepts `98XXXXXXXX`, `97XXXXXXXX`, `+97798XXXXXXXX`, and `97798XXXXXXXX`\n- Removes spaces, hyphens, parentheses, and dots\n- Small, readable, and easy to audit\n\n## Install\n\n```bash\nnpm install @diwaskhatri/nepal-phone\n```\n\n## Quick start\n\n```js\nimport {\n  isNepalPhone,\n  normalizeNepalPhone,\n  formatNepalPhone,\n  getNepalPhoneParts\n} from \"@diwaskhatri/nepal-phone\";\n\nisNepalPhone(\"984-123-4567\");\n// true\n\nnormalizeNepalPhone(\"+977 9841234567\");\n// \"9841234567\"\n\nformatNepalPhone(\"9841234567\");\n// \"+977 9841234567\"\n\ngetNepalPhoneParts(\"+977 9841234567\");\n// {\n//   countryCode: \"+977\",\n//   nationalNumber: \"9841234567\",\n//   internationalNumber: \"+9779841234567\"\n// }\n```\n\n## API\n\n### `isNepalPhone(value)`\n\nReturns `true` for a valid Nepali mobile number and `false` otherwise. The current release supports the `97` and `98` mobile prefixes.\n\n### `normalizeNepalPhone(value)`\n\nRemoves common formatting characters and an optional `+977` or `977` country code. Invalid values are returned as normalized strings so that you can decide how to handle them.\n\n### `formatNepalPhone(value)`\n\nReturns a valid number in the canonical `+977 98XXXXXXXX` format. Throws a `TypeError` when the value is invalid.\n\n### `getNepalPhoneParts(value)`\n\nReturns the country code, normalized national number, and international number for a valid Nepali mobile number. Throws a `TypeError` for invalid input.\n\n### `NEPAL_COUNTRY_CODE_PREFIX`\n\nThe exported constant `\"+977\"`.\n\n## TypeScript\n\nType declarations are included:\n\n```ts\nimport { isNepalPhone } from \"@diwaskhatri/nepal-phone\";\n\nconst valid: boolean = isNepalPhone(\"9812345678\");\n```\n\n## Development\n\n```bash\ngit clone https://github.com/DiwasKhatri07/nepal-phone.git\ncd nepal-phone\nnpm install\nnpm test\nnpm run test:jest\nnpm run check\n```\n\nThe project includes both Node's built-in test runner and Jest. Run `npm run test:jest` to execute the Jest examples in `test/index.jest.test.js`. Please add or update tests when changing behavior.\n\n## Release 1.1.0\n\nVersion 1.1.0 adds `getNepalPhoneParts(value)`, which is useful when an application needs separate country-code, national-number, and international-number fields without repeating parsing logic.\n\n## Roadmap\n\n- [ ] Add configurable mobile-prefix metadata\n- [ ] Add optional Nepali numeral conversion\n- [ ] Add CommonJS compatibility without increasing runtime dependencies\n- [ ] Add broader regional and landline validation after the rules are verified\n\n## Contributing\n\nIssues, ideas, documentation improvements, and pull requests are welcome. Please read [CONTRIBUTING.md](./CONTRIBUTING.md) before opening a pull request and follow the project's [Code of Conduct](./CODE_OF_CONDUCT.md).\n\n## Support the project\n\nIf Nepal Phone saves you time, you can support continued open-source work with a coffee:\n\n<a href=\"https://ko-fi.com/diwaskhatri\"><img src=\"https://storage.ko-fi.com/cdn/kofi3.png?v=3\" alt=\"Buy Diwas Khatri a coffee\" height=\"36\" /></a>\n\n## License\n\nReleased under the [MIT License](./LICENSE). Copyright © 2026 Diwas Khatri.\n","readmeFilename":"README.md"}