Skip to content

Commit

Permalink
check hasOwnProperty() before using
Browse files Browse the repository at this point in the history
  • Loading branch information
Maizify committed Sep 21, 2016
1 parent 8a58173 commit ca9479d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export function JSONStringify(obj) {
lv++;
for (let i=0; i<keys.length; i++) {
let k = keys[i];
if (!val.hasOwnProperty(k)) { continue; }
if (val.hasOwnProperty && !val.hasOwnProperty(k)) { continue; }
json += k + ': ';
_iterateObj(val[k], val);
if (i < keys.length - 1) {
Expand Down
2 changes: 1 addition & 1 deletion src/log/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ class VConsoleLogTab extends VConsolePlugin {
key: tool.htmlEncode(keys[i]), keyType: keyType, value: name, valueType: 'object'
}, true));
} else {
if (!obj.hasOwnProperty(keys[i])) {
if (obj.hasOwnProperty && !obj.hasOwnProperty(keys[i])) {
keyType = 'private';
}
let renderData = {lineType: 'kv', key: tool.htmlEncode(keys[i]), keyType: keyType, value: tool.htmlEncode(val), valueType: valueType};
Expand Down

0 comments on commit ca9479d

Please sign in to comment.