-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
bugBug or defectBug or defectfeatureNew functionality or improvementNew functionality or improvement
Milestone
Description
Context
- node version: 7.5
- joi version: 6.10.1
- environment (node, browser): node
- used with (hapi, standalone, ...): standalone
- any other relevant information:
What are you trying to achieve or the steps to reproduce ?
I was just playing around with this lib and I found something weird. Number('0x1') and parseInt('0x1') equal 1 but Joi doesn't see it that way. Joi converts a string '0x...' hex number to zero.
> j = require('joi'); j.validate('0x1', j.number())
{ error: null, value: 0 }
// yet
> j = require('joi'); j.validate('1', j.number())
{ error: null, value: 1 }Which result you had ?
value = 0
What did you expect ?
value = 1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugBug or defectBug or defectfeatureNew functionality or improvementNew functionality or improvement