(items, itemHeading, itemsSeen, linktoFn)
| 315 | } |
| 316 | |
| 317 | function buildMemberNav(items, itemHeading, itemsSeen, linktoFn) { |
| 318 | const subCategories = items.reduce((memo, item) => { |
| 319 | const subCategory = item.subCategory || '' |
| 320 | memo[subCategory] = memo[subCategory] || [] |
| 321 | return { |
| 322 | ...memo, |
| 323 | [subCategory]: [...memo[subCategory], item] |
| 324 | } |
| 325 | }, {}) |
| 326 | |
| 327 | const subCategoryNames = Object.keys(subCategories) |
| 328 | |
| 329 | var nav = '' |
| 330 | |
| 331 | subCategoryNames.forEach((subCategoryName) => { |
| 332 | const subCategoryItems = subCategories[subCategoryName] |
| 333 | if (subCategoryItems.length) { |
| 334 | var itemsNav = '' |
| 335 | |
| 336 | subCategoryItems.forEach(function(item) { |
| 337 | var displayName |
| 338 | |
| 339 | if ( !hasOwnProp.call(item, 'longname') ) { |
| 340 | itemsNav += '<li>' + linktoFn('', item.name) + '</li>' |
| 341 | } |
| 342 | else if ( !hasOwnProp.call(itemsSeen, item.longname) ) { |
| 343 | if (env.conf.templates.default.useLongnameInNav) { |
| 344 | displayName = item.longname |
| 345 | } else { |
| 346 | displayName = item.name |
| 347 | } |
| 348 | itemsNav += '<li>' + linktoFn(item.longname, displayName.replace(/\b(module|event):/g, '')) |
| 349 | |
| 350 | if (item.children && item.children.length) { |
| 351 | itemsNav += '<ul>' |
| 352 | item.children.forEach(child => { |
| 353 | if (env.conf.templates.default.useLongnameInNav) { |
| 354 | displayName = child.longname |
| 355 | } else { |
| 356 | displayName = child.name |
| 357 | } |
| 358 | itemsNav += '<li>' + linktoFn(child.longname, displayName.replace(/\b(module|event):/g, '')) + '</li>' |
| 359 | }) |
| 360 | itemsNav += '</ul>' |
| 361 | } |
| 362 | |
| 363 | itemsNav += '</li>' |
| 364 | |
| 365 | itemsSeen[item.longname] = true |
| 366 | } |
| 367 | }) |
| 368 | |
| 369 | if (itemsNav !== '') { |
| 370 | var heading = itemHeading |
| 371 | if (subCategoryName) { |
| 372 | heading = heading + ' / ' + subCategoryName |
| 373 | } |
| 374 | nav += '<h3>' + heading + '</h3><ul>' + itemsNav + '</ul>' |
no outgoing calls
no test coverage detected
searching dependent graphs…