required
required([strict=false])
作用
参数
示例
const schema1 = racoon.string();
schema1.validate(undefined); // pass, 返回值为 undefined
schema1.validate(null); // pass, 返回值为 null
schema1.validate(''); // pass, 返回值为 空字符串
const schema2 = racoon.string().required();
schema2.validate(undefined); // fail
schema2.validate(null); // fail
schema2.validate(''); // pass
const schema3 = racoon.string().required(true);
schema3.validate(undefined); // fail
schema3.validate(null); // fail
schema3.validate(''); // fail最后更新于