-
Notifications
You must be signed in to change notification settings - Fork 9k
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
Add validateMaximum & validateMinimum #3703
Conversation
This address some of the validation requested on Issue #993
src/core/utils.js
Outdated
if (err) errors.push(err) | ||
} | ||
|
||
if (minimum) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this handle negative minimum values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure it will, what makes you think it won't?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought for a second that negative integers would evaluate as false, but I was wrong. The only number that does is 0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the test to verify!
Testing valid negative number with min and max
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good (thanks for the tests!), except that minimum: 0
and maximum: 0
do not trigger validation.
I'll make these changes now.
Thanks @heldersepu! |
This address some of the validation requested on Issue #993