From a8a0c969588729601804a92ab22356c395348ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20Jos=C3=A9?= Date: Thu, 6 Jun 2019 22:47:22 -0300 Subject: [PATCH] Method to valid any object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabio José --- lib/specs/spec_0_2.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/specs/spec_0_2.js b/lib/specs/spec_0_2.js index ac105b7..489af96 100644 --- a/lib/specs/spec_0_2.js +++ b/lib/specs/spec_0_2.js @@ -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){