stripUnkown
stripUnkown()
作用
参数
示例
const schema1 = racoon.object({
name: racoon.string()
}).allowUnkown();
const result1 = schema1.validate({
name: 'Jack',
age: 22
}); // pass, and result1 is { name: 'Jack', age: 22 }
const schema2 = racoon.object({
name: racoon.string()
}).allowUnkown().stripUnkown();
const result2 = schema2.validate({
name: 'Jack',
age: 22
}); // pass, and result1 is { name: 'Jack' }最后更新于