From 81080456dd8af73fce57c458474620a5f54db59b Mon Sep 17 00:00:00 2001 From: "raymond.lam" Date: Wed, 10 May 2017 08:03:42 -0400 Subject: [PATCH] pop lookup needs to use hasOwnProperty for non-objs --- mustache.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mustache.js b/mustache.js index 52fa354..069c490 100644 --- a/mustache.js +++ b/mustache.js @@ -42,7 +42,10 @@ * including its prototype, has a given property */ function hasProperty (obj, propName) { - return obj != null && (propName in obj); + return ( + (obj != null && typeof obj === 'object' && (propName in obj)) + || (obj !== undefined && obj.hasOwnProperty(propName)) + ); } // Workaround for https://issues.apache.org/jira/browse/COUCHDB-577