The invalid method invokes 'validate()', but returns true if schema could not be validated.
This is nice as a shorthand when checking for incorrect schemas, like so:
function test(param) {
if (Duns.number().invalid(param) ) throw new Error('Not a number');
}
// Without invalid this would look like this, which I think is a little more verbose.
function test(param) {
if (Duns.number().validate(param) === false) throw new Error('Not a number');
}
The invalid method invokes 'validate()', but returns true if schema could not be validated. This is nice as a shorthand when checking for incorrect schemas, like so: