From f6f6a3b02d667aa4ba2d5d50cc19208c4462abfa Mon Sep 17 00:00:00 2001 From: Kris Zyp Date: Mon, 1 Nov 2021 20:47:49 -0600 Subject: [PATCH] Use a little more robust method of checking instances --- lib/validate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/validate.js b/lib/validate.js index 8992d6d..cace89e 100644 --- a/lib/validate.js +++ b/lib/validate.js @@ -208,7 +208,7 @@ var validate = exports._validate = function(/*Any*/instance,/*Object*/schema,/*O for(var i in objTypeDef){ if(objTypeDef.hasOwnProperty(i) && i != '__proto__' && i != 'constructor'){ - var value = instance[i]; + var value = instance.hasOwnProperty(i) ? instance[i] : undefined; // skip _not_ specified properties if (value === undefined && options.existingOnly) continue; var propDef = objTypeDef[i];