校验函数一般使用于检查用户输入内容是否符合要求。如邮箱、密码、手机号码等
函数封装
/**
* 校验/检测函数封装
* @param {Object} self 检测对象
* @param {Object} option 检测参数(可选)
*/
const check = (self = this, option) => {
if (typeof self === "undefined") {
throw new Error("check requires a element");
}
/**
* 检测参数配置
* @param {String} type 检测类型
* @param {Function} success 正确回调函数
* @param {Function} error 错误回调函数
*/
if(option === undefined)