We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
const schema = Joi.number() const result = schema.validate('-0')
error type 'number.unsafe'
{ error: null, value: 0 }
because:
const schema = Joi.number() schema.validate('+0') // => { error: null, value: 0 }
The text was updated successfully, but these errors were encountered:
I think the problem lies in this line.
parseFloat("-0").toString() // "0" internals.normalizeDecimal("-0") // "-0"
Sorry, something went wrong.
6d6f90f
@hueniverse I'm not a fan of converting the -0 value to 0. It means that the following produces different values:
-0
0
schema.validate('-0'); // => { value: 0 } schema.validate(-0); // => { value: -0 }
Also, Joi.number().integer().validate(-0) does not fail as expected.
Joi.number().integer().validate(-0)
I think all -0 should be 0. It's just stupid. I'll make sure to make it consistent.
hueniverse
No branches or pull requests
Context
What are you trying to achieve or the steps to reproduce ?
Which result you had ?
error type 'number.unsafe'
What did you expect ?
because:
The text was updated successfully, but these errors were encountered: