is-chinese-phone-number
中国电话号码验证函数。
Last updated 6 years ago by funch .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install is-chinese-phone-number 
SYNC missed versions from official npm registry.

isChinesePhoneNumber Travis CI Coverage Status

中国电话号码验证函数。支持验证手机号码、座机号码。

背景资料:使用 JavaScript 验证中国手机号码和座机号码

安装

# yarn
yarn add is-chinese-phone-number

# or, npm
npm i is-chinese-phone-number

CDN:jsDelivr | UNPKG (可通过全局变量 isChinesePhoneNumber 使用)

使用

验证中国电话号码

语法:

isChinesePhoneNumber(phoneNumber: string | number, strict: boolean = false): boolean

示例:

isChinesePhoneNumber('10086') // ==> false
isChinesePhoneNumber('18087030020') // ==> true
isChinesePhoneNumber('010-88888888') // ==> true

验证中国手机号码

语法:

isChinesePhoneNumber.mobile(phoneNumber: string | number, strict: boolean = false): boolean

示例:

isChinesePhoneNumber.mobile('10086') // ==> false
isChinesePhoneNumber.mobile('18087030020') // ==> true
isChinesePhoneNumber.mobile('010-88888888') // ==> false

验证中国座机号码

语法:

isChinesePhoneNumber.landline(phoneNumber: string | number, strict: boolean = false): boolean

示例:

isChinesePhoneNumber.landline('10086') // ==> false
isChinesePhoneNumber.landline('18087030020') // ==> false
isChinesePhoneNumber.landline('010-88888888') // ==> true

Current Tags

  • 0.1.9                                ...           latest (6 years ago)

10 Versions

  • 0.1.9                                ...           6 years ago
  • 0.1.8                                ...           6 years ago
  • 0.1.7                                ...           6 years ago
  • 0.1.6                                ...           6 years ago
  • 0.1.5                                ...           6 years ago
  • 0.1.4                                ...           6 years ago
  • 0.1.3                                ...           6 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Total 8
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (0)
None
Dev Dependencies (9)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE