text: 'use strict'
  
  Object.defineProperty(exports, '__esModule', {
    value: true
  })
  
  var _plain = require('./structure/plain')
  
  var _plain2 = _interopRequireDefault(_plain)
  
  function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : { default: obj }
  }
  
  var toArray = function toArray(value) {
    return Array.isArray(value) ? value : [value]
  }
  
  var getError = function getError(value, values, props, validators, name) {
    var array = toArray(validators)
    for (var i = 0; i < array.length; i++) {
      var error = array[i](value, values, props, name)
      if (error) {
        return error
      }
    }
  }
  
  var generateValidator = function generateValidator(validators, _ref) {
    var getIn = _ref.getIn
    return function(values, props) {
      var errors = {}
      Object.keys(validators).forEach(function(name) {
        var value = getIn(values, name)
        var error = getError(value, values, props, validators[name], name)
        if (error) {
          errors = _plain2.default.setIn(errors, name, error)
        }
      })
      return errors
    }
  }
  
  exports.default = generateValidator
  