Method to valid any object

Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
Fabio José 2019-06-06 22:47:22 -03:00
parent a095a7f0ca
commit a8a0c96958
1 changed files with 7 additions and 5 deletions

View File

@ -30,16 +30,18 @@ function Spec02(){
}
/*
* Check the spec constraints.
* Check the spec constraints
*/
Spec02.prototype.check = function(){
var valid = validate(this.payload);
Spec02.prototype.check = function(ce){
var to_check = ce;
if(!to_check) {
to_check = this.payload;
}
var valid = validate(to_check);
if(!valid) {
throw {message: "invalid payload", errors: validate.errors};
}
};
Spec02.prototype.type = function(_type){