Undefined min, max, gt, lt values taken into consideration during validation
jrtitus opened this issue · 2 comments
jrtitus commented
Describe the bug
Properties of an object are considered undefined
unless set, but an explicit undefined
value is taken into consideration when determining if isInt
or isFloat
succeeds due to the use of hasOwnProperty
.
Lines 18 to 21 in b958bd7
Examples
import { isInt } from 'validator'
isInt("5") // => true
isInt("5", {min: 0, max: 10}) // => true
isInt("5", { }} // => true
isInt("5", {min: undefined, max: undefined}) // => false
Maybe it's just my opinion, but I think that last one should also return true
.
Additional context
Validator.js version: validator@13.11.0
Node.js version: Node 18.17.1
OS platform: linux
dk172923 commented
Can you assign it to me?