custom
custom(callback, [ctx])
Effect
Arguments
Example
const schema = racoon.string().custom((val) => {
if (val.length % 2 === 0) {
return true;
}
throw new Error('The length of detected string should be even');
});
schema.validate('12'); // pass
schema.validate('123'); // failLast updated