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.5", | ||
| "version": "1.0.6", | ||
| "description": "flame前端工具类", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
+3
-3
@@ -1,7 +0,7 @@ | ||
| import checkPhoneNum from 'untils/checkPhoneNum.js' | ||
| import checkPhoneNum from './utils/checkPhoneNum.js' | ||
| let flame = { | ||
| untils: { | ||
| utils: { | ||
| checkPhoneNum: checkPhoneNum | ||
| } | ||
| } | ||
| export default flameUntils | ||
| export default flameUtils |
| 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 | ||
| } |
2248
-0.04%