is-chinese-phone-number
Version:
中国电话号码验证函数。支持验证手机号码、座机号码。
8 lines (7 loc) • 808 B
JavaScript
/*!
* is-chinese-phone-number v0.1.9
* (c) 2018-present Jay Fong <fjc0kb@gmail.com> (https://github.com/fjc0k)
* Released under the MIT License.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.isChinesePhoneNumber=t()}(this,function(){"use strict";var i=[/^1[3-9][0-9]{9}$/,/^1(?:3[0-9]|4[5-9]|5[0-9]|6[12456]|7[0-8]|8[0-9]|9[0-9])[0-9]{8}$/],o=[/^(?:0[1-9][0-9]{1,2}-)?[2-8][0-9]{6,7}$/,/^0[1-9][0-9]{1,2}-[2-8][0-9]{6,7}$/],e=function(e,t){void 0===t&&(t=!1);var n=t?1:0;return i[n].test(e)||o[n].test(e)};return e.mobile=function(e,t){return void 0===t&&(t=!1),i[t?1:0].test(e)},e.landline=function(e,t){return void 0===t&&(t=!1),o[t?1:0].test(e)},e});
//# sourceMappingURL=is-chinese-phone-number.min.js.map