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) } }; }