You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
lockbot
locked as resolved and limited conversation to collaborators
Jan 9, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Context
What are you trying to achieve or the steps to reproduce ?
I'm trying to validate a possitive integer which length is between 10 and 15 characters
This is the code I am using
function validateNumber (value) {
return _.isNull(joi.validate(value, joi.string().required().min(10).max(15)).error) &&
_.isNull(joi.validate(value, joi.number().integer().min(0).required()).error);
}
Which result you had ?
I used as a value 999999999. (9 integers and a decimal point) and joi validates it as a 10 digit integer
What did you expect ?
I expected it to throw an error as it is not a digit. Given 999999999.9 as value throws an error correctly.
The text was updated successfully, but these errors were encountered: