The above should return an error if req.body contains more object keys than defined in the rule
A solution could be to add a third instance parameter to new Validator(data,rule,strict)
strict would either be true or false.
This would mean whether the validator should follow the rule strictly not allowing additional keys or not.
I am using the version
3.22.1
Could it be possible to have a feature where the validator can return an error if data key with that is not defined in the rule is passed for instance
The above should return an error if
req.body
contains more object keys than defined in the ruleA solution could be to add a third instance parameter to
new Validator(data,rule,strict)
strict would either be true or false. This would mean whether the validator should follow the rule strictly not allowing additional keys or not.