mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
don’t create empty children objects
This commit is contained in:
parent
fb2c36781f
commit
f1b6b2dc7c
@ -337,7 +337,7 @@ exports.longnamesToTree = function longnamesToTree(longnames, doclets) {
|
||||
|
||||
longnames.forEach(function(longname) {
|
||||
var currentLongname = '';
|
||||
var currentNavItem = tree;
|
||||
var currentParent = tree;
|
||||
var nameInfo;
|
||||
var processed;
|
||||
|
||||
@ -352,14 +352,18 @@ exports.longnamesToTree = function longnamesToTree(longnames, doclets) {
|
||||
processed.chunks.forEach(function(chunk) {
|
||||
currentLongname += chunk;
|
||||
|
||||
if (!hasOwnProp.call(currentNavItem, chunk)) {
|
||||
currentNavItem[chunk] = nameInfo[currentLongname];
|
||||
if (currentParent !== tree) {
|
||||
currentParent.children = currentParent.children || {};
|
||||
currentParent = currentParent.children;
|
||||
}
|
||||
|
||||
if (currentNavItem[chunk]) {
|
||||
currentNavItem[chunk].doclet = doclets ? doclets[currentLongname] : null;
|
||||
currentNavItem[chunk].children = currentNavItem[chunk].children || {};
|
||||
currentNavItem = currentNavItem[chunk].children;
|
||||
if (!hasOwnProp.call(currentParent, chunk)) {
|
||||
currentParent[chunk] = nameInfo[currentLongname];
|
||||
}
|
||||
|
||||
if (currentParent[chunk]) {
|
||||
currentParent[chunk].doclet = doclets ? doclets[currentLongname] : null;
|
||||
currentParent = currentParent[chunk];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user