%PDF- %PDF-
Direktori : /home/emergentqj/actioncivile/pre-auth/.8352c036a19b0051d0217d27d25e3f4a/static/node_modules/redux-form/es/ |
Current File : /home/emergentqj/actioncivile/pre-auth/.8352c036a19b0051d0217d27d25e3f4a/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; }; }