igi_orion_cignacmb
Version:
Censors words out of text
31 lines (30 loc) • 741 B
JavaScript
/*
* @Author: weicong.ling
* @Date: 2020-05-06 10:03:29
* @Last Modified by: weicong.ling
* @Last Modified time: 2020-05-11 14:16:48
*/
/**
*
* @param {手机号码} result
*/
var phone = function (result) {
var value = result.field.value;
var error = {
isCorrect: true,
type: "modal",
msg: "请输入正确的" + result.name,
code: "",
id: result.id
};
try {
var patt1 = new RegExp("^[1][3,4,5,6,7,8,9][0-9]{9}$");//验证长度,第一位数必须是1
if (!patt1.test(value)) {
error.isCorrect = false;
}
} catch (error) {
console.error(error)
}
return error;
};
module.exports = phone;