nepali-number-validator
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

Introducing Nepali Number Validator

This is a simple typescript based library to validate Nepali numbers format. It can also give you the operator details of the number.

Installation

npm install @cb/nepali-number-validator
yarn add @cb/nepali-number-validator
pnpm add @cb/nepali-number-validator

Usage

// ES Modules
import { isNepaliPhoneNumber, getPhoneNumberDetails  } from '@cb/nepali-number-validator';

// CommonJS
const { isNepaliPhoneNumber, getPhoneNumberDetails } = require('@cb/nepali-number-validator');

// isNepaliPhoneNumber
isNepaliPhoneNumber('9809373953'); // true
isNepaliPhoneNumber('+9779809373953'); // true
isNepaliPhoneNumber('+977 9809373953'); // true
isNepaliPhoneNumber('9779809373953'); // true
isNepaliPhoneNumber('977 9809373953'); // true

isNepaliPhoneNumber('98412345678'); // false
isNepaliPhoneNumber('9876543210'); // false

// getPhoneNumberDetails
// give the details only if the number is valid
getPhoneNumberDetails('9809373953'); // { name: 'Ncell', code: 'NCELL', phoneNumber: '+977 9809373953' }

Package Sidebar

Install

npm i nepali-number-validator

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

7.97 kB

Total Files

7

Last publish

Collaborators

  • projectashik