all files / src/Validator/ index.js

50% Statements 2/4
100% Branches 0/0
0% Functions 0/2
50% Lines 2/4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15                         
import Validator from 'validatorjs';
import Regexp from '../Regexp'
import {isIdCard} from "../Type";
 
// 1.手机号验证器
Validator.register('phone', function(value, requirement, attribute) {
  return value.match(Regexp.phone);
}, 'The :attribute phone number is vaild');
// 2.身份证号验证器
Validator.register('idcard', function(value, requirement, attribute) {
  return isIdCard(value,true);
}, 'The :attribute phone number is vaild');
 
export default Validator