and
$and
A constraint that checks whether all the provided processors return a truthy value.
Returns the last truthy value from the processors, or throws if any are falsey. Be careful to not use this in a situation where the provided processors may require late-resolved values! This works best in finalizers, validators, or in opaque schema transformers.
See $all if you want to check for success (defined value) instead of truthiness
Parameters
processors(Array<ProcessorSpec>, required): Array of processor specifications, all of which must return a truthy value.
Example
// Require a string to be both non-empty and a valid email
new Schema('string').validator({$and: ['$non-empty', '$email']})
// Require a number to be positive and within range
new Schema('number').validator({
$and: ['$positive', {$range: {max: 1000}}]
})