/**
 * Created by baoyinghai on 12/5/16.
 */
import validation from '../../../../utils/validation';
import { isEmpty } from '../../../../utils/EmptyUtils';

const validator = (record, value, formValues, form, opt = {}) => {
  const reg = new RegExp(opt.regex);
  if (!isEmpty(value) && !reg.test(value)) {
    return new Error((opt.message) || '不匹配正则');
  }
  return null;
};

export default validator;
