flame-utils
Advanced tools
| let checkPhoneNum = function(phone_num, check_types = ['phone', 'landline']) { | ||
| let check_list = { | ||
| phone: /^((13[0-9])|(14[5-9])|(15([0-3]|[5-9]))|(16[6-7])|(17[1-8])|(18[0-9])|(19[1-3])|(19[5|6])|(19[8|9]))\d{8}$/, // 手机 | ||
| landline: /^\d{3}-\d{7,8}|\d{4}-\d{7,8}$/, // 座机 | ||
| } | ||
| for (let type of check_types) { | ||
| if (check_list[type].test(phone_num)) { | ||
| return true | ||
| } | ||
| } | ||
| return false | ||
| } |
+1
-1
| { | ||
| "name": "flame-utils", | ||
| "version": "1.0.3", | ||
| "version": "1.0.4", | ||
| "description": "flame前端工具类", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
+1
-1
@@ -1,2 +0,2 @@ | ||
| import checkPhoneNum from 'untils/demo.js' | ||
| import checkPhoneNum from 'untils/checkPhoneNum.js' | ||
| let flame = { | ||
@@ -3,0 +3,0 @@ untils: { |
| let checkPhoneNum = function(phone_num, check_types = ['phone', 'landline']) { | ||
| let check_list = { | ||
| phone: /^((13[0-9])|(14[5-9])|(15([0-3]|[5-9]))|(16[6-7])|(17[1-8])|(18[0-9])|(19[1-3])|(19[5|6])|(19[8|9]))\d{8}$/, // 手机 | ||
| landline: /^\d{3}-\d{7,8}|\d{4}-\d{7,8}$/, // 座机 | ||
| } | ||
| for (let type of check_types) { | ||
| if (check_list[type].test(phone_num)) { | ||
| return true | ||
| } | ||
| } | ||
| return false | ||
| } |
2249
0.4%