Closed auloin closed 5 years ago
I don't see where name is stringified and becomes "null"
. I understand the point you are making, but not sure where this type conversion is happening?
I don't understand the architecture of the new version yet but here is where it's happening in the old version: https://github.com/poppinss/indicative/blob/5.0.8/src/validations/min.js
get(data, field)
=> returns null
Array.isArray(fieldValue) ? fieldValue : String(fieldValue)
=> returns "null"
Yup, this has been fixed. Also, I have added tests around same to ensure that it is not a problem anymore. https://github.com/poppinss/indicative-rules/commit/b85df9ebb8225eddaf1f0d2c1a415a562b32075e
The
prop
function frompope
evaluates unset fields as null instead of undefined which gives unexpected result in the validation. This happens when in strict mode.Package version
5.0.8
Node.js and npm version
node: v11.7.0 npm: 6.9.0
Sample Code (to reproduce the issue)
Result
At first look you would believe that
name
is doing what's expected, skipped when undefined but that's not the case.name
is evaluated asnull
which in turn is stringified and becomes"null"
. This is why password validation is failing without the password being set.That being said, shouldn't
null
be considered asskippable
in strict mode?