我想要做的是验证对象属性的类型
例如
var correctObject = {
name : "John",
age : 25
};
var constraints = {
...
};
validate(testObject, constraints);
//undefined test passes
var incorrectObject = {
name : "John",
age : "25"
};
validate(incorrectObject, constraints);
// age must be a string