Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValidateForm function error!!!! #71

Open
blackraindrop opened this issue Jan 20, 2020 · 0 comments
Open

ValidateForm function error!!!! #71

blackraindrop opened this issue Jan 20, 2020 · 0 comments

Comments

@blackraindrop
Copy link

blackraindrop commented Jan 20, 2020

Keyword arguments can't use array.concat

before

export default function validateForm (validations) {
  /* istanbul ignore next */
  return function () {
    return process(validations, arguments)
  }
}
function process (validations, args, keys) {
  const errors = {}
  for (let attr in validations) {
    if (HAS_PROP.call(validations, attr) && validations[attr]) {
      let attrKeys = keys ? keys.concat(attr) : [attr]
      errors[attr] = isObject(validations[attr])
        ? process(validations[attr], args, attrKeys)
        : firstErr([].concat(validations[attr])).apply(null, /* Has Error */[].concat(getIn(args[0], attrKeys), args))
    }
  }
  return errors
}

after

export default function validateForm (validations) {
  /* istanbul ignore next */
  return function () {
    return process(validations, [].slice.call(arguments))
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant