From ced7efcf1d04a438c2aec0b11c4b5519101e060b Mon Sep 17 00:00:00 2001 From: sourav sarkar Date: Sat, 28 Oct 2017 00:11:31 +0530 Subject: [PATCH 1/2] Use Object.prototype.hasOwnProperty ref: https://stackoverflow.com/questions/12017693/why-use-object-prototype-hasownproperty-callmyobj-prop-instead-of-myobj-hasow --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 3590f3b..22506d1 100644 --- a/index.js +++ b/index.js @@ -21,7 +21,7 @@ function filterObjectOnSchema(schema, doc) { if (sp.type == 'object') { // check if property-less object (free-form) - if (sp.hasOwnProperty('properties')) { + if (Object.prototype.hasOwnProperty.call(sp,'properties')) { results[key] = filterObjectOnSchema(sp, doc[key]); } else { if (Object.keys(doc[key]).length > 0) { From d1f8ea5c983f737de61593298f3b855cc53d0991 Mon Sep 17 00:00:00 2001 From: Samuel Bolduc Date: Fri, 27 Oct 2017 14:45:25 -0400 Subject: [PATCH 2/2] Add a space --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 22506d1..70df13e 100644 --- a/index.js +++ b/index.js @@ -21,7 +21,7 @@ function filterObjectOnSchema(schema, doc) { if (sp.type == 'object') { // check if property-less object (free-form) - if (Object.prototype.hasOwnProperty.call(sp,'properties')) { + if (Object.prototype.hasOwnProperty.call(sp, 'properties')) { results[key] = filterObjectOnSchema(sp, doc[key]); } else { if (Object.keys(doc[key]).length > 0) {