/**
 * 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 handle = validation.isTelephone;
  if (!isEmpty(value) && !handle(value)) {
    return new Error((opt.message) || '格式错误');
  }
  return null;
};

export default validator;
