Closed jrtitus closed 2 weeks ago
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.
undefined
isInt
isFloat
hasOwnProperty
https://github.com/validatorjs/validator.js/blob/b958bd7d1026a434ad3bf90064d3dcb8b775f1a9/src/lib/isInt.js#L18-L21
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.
true
Additional context Validator.js version: validator@13.11.0 Node.js version: Node 18.17.1 OS platform: linux
validator@13.11.0
Node 18.17.1
linux
Can you assign it to me?
closed by #2416
Describe the bug Properties of an object are considered
undefined
unless set, but an explicitundefined
value is taken into consideration when determining ifisInt
orisFloat
succeeds due to the use ofhasOwnProperty
.https://github.com/validatorjs/validator.js/blob/b958bd7d1026a434ad3bf90064d3dcb8b775f1a9/src/lib/isInt.js#L18-L21
Examples
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