Closed jason-curtis closed 11 months ago
The example at the linked section of the README works.
Validator mode outputs errors on a separate property, not via returning them, to ensure that a simple if (validate(x))
mistake is never made by the consumer (as it might have caused a security vuln if validate
return value wasn't a simple bool).
See Error handling for more documentation.
According to the README, this should create a validator that returns errors:
const validate = validator(schema, { includeErrors: true })
Instead, that validator only returns
true
orfalse
.Failing Jest test case:
error returned: