Method to valid any object
Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
parent
a095a7f0ca
commit
a8a0c96958
|
@ -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){
|
||||
|
|
Loading…
Reference in New Issue