custom
custom(callback, [ctx])
作用
参数
示例
const schema = racoon.object().custom((val) => {
if (val.includes(1)) {
return true;
}
throw new Error('被检测数组必须包含数字1');
});
schema.validate([1, 2]); // pass
schema.validate([2, 3]); // fail最后更新于