'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _validation = require('../../../../utils/validation');

var _validation2 = _interopRequireDefault(_validation);

var _EmptyUtils = require('../../../../utils/EmptyUtils');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * Created by baoyinghai on 12/5/16.
 */
var validator = function validator(record, value, formValues, form) {
  var opt = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};

  var handle = _validation2.default.isTelephone;
  if (!(0, _EmptyUtils.isEmpty)(value) && !handle(value)) {
    return new Error(opt.message || '格式错误');
  }
  return null;
};

exports.default = validator;