From 5b5189100872104ce6a9640d28534a0c2b594d2e Mon Sep 17 00:00:00 2001 From: Denis Bardadym Date: Sat, 26 Mar 2016 18:45:29 +0300 Subject: [PATCH] Fix when you want to document Object.prototype's methods --- lib/hierarchy.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/hierarchy.js b/lib/hierarchy.js index 64b14a2f0..ea5948e94 100644 --- a/lib/hierarchy.js +++ b/lib/hierarchy.js @@ -1,5 +1,7 @@ 'use strict'; +var hasOwnProperty = Object.prototype.hasOwnProperty; + /** * @param {Array} comments an array of parsed comments * @returns {Array} nested comments, with only root comments @@ -9,8 +11,8 @@ module.exports = function (comments) { var id = 0, root = { members: { - instance: {}, - static: {} + instance: Object.create(null), + static: Object.create(null) } }; @@ -44,12 +46,12 @@ module.exports = function (comments) { scope = segment[0], name = segment[1]; - if (!node.members[scope].hasOwnProperty(name)) { + if (!hasOwnProperty.call(node.members[scope], name)) { node.members[scope][name] = { comments: [], members: { - instance: {}, - static: {} + instance: Object.create(null), + static: Object.create(null) } }; }