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

Validator.getErrors() throws an error on undefined fields #66

Closed
XX-NF-XX opened this issue Mar 17, 2019 · 0 comments · Fixed by #67
Closed

Validator.getErrors() throws an error on undefined fields #66

XX-NF-XX opened this issue Mar 17, 2019 · 0 comments · Fixed by #67

Comments

@XX-NF-XX
Copy link
Contributor

XX-NF-XX commented Mar 17, 2019

Example:

const validator = new Validator({
  str: new Rule(
    { type: 'string' },
    'Error message'
  )
});

validator.getErrors({
  str: undefined,
}); // Error thrown: Cannot read property 'constructor' of undefined

Expected behavior: [ 'Error message' ]

P.S. null and undefined have no constructor in JS

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

Successfully merging a pull request may close this issue.

1 participant