custom
custom(callback, [ctx])
作用
参数
示例
const schema = racoon.string().custom((val) => {
if (val === false) {
return true;
}
throw new Error('被检测值必须为false');
});
schema.validate(false); // pass
schema.validate(true); // fail最后更新于
custom(callback, [ctx])
const schema = racoon.string().custom((val) => {
if (val === false) {
return true;
}
throw new Error('被检测值必须为false');
});
schema.validate(false); // pass
schema.validate(true); // fail最后更新于