VN-PHONE-VALIDATOR

vn-phone-validator is a package support validate mobile phone number for five operator in Viet Nam, includes Viettel, Mobiphone, Vinaphone, Vietnamobile and Gmobile.

  • Compact

  • Fast

  • Powerful

Note: Only for ten digit number or eleven digit with area code!

Installation

requires Node.jsarrow-up-right v4+ to run.

$ npm i vn-phone-validator

Use

const phoneValidate = require('vn-phone-validator')
phoneValidate.validate('0988888888').isValidate    // true
phoneValidate.validate('0988 888 888').isValidate  // true
phoneValidate.validate('84988 888 888').isValidate // true
phoneValidate.validate('0123456789').isValidate    // false

Options

strict: true/false

format: string

operator: array (viettel, vinaphone, mobilephone, vietnamobile, gmobile)

Function

operator

hidden

format

Test

License

MIT

Last updated