Преглед изворни кода

pop lookup needs to use hasOwnProperty for non-objs

pull/618/head
raymond.lam пре 9 година
родитељ
комит
81080456dd
1 измењених фајлова са 4 додато и 1 уклоњено
  1. +4
    -1
      mustache.js

+ 4
- 1
mustache.js Прегледај датотеку

@@ -42,7 +42,10 @@
* including its prototype, has a given property * including its prototype, has a given property
*/ */
function hasProperty (obj, propName) { 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 // Workaround for https://issues.apache.org/jira/browse/COUCHDB-577


Loading…
Откажи
Сачувај