MCPcopy
hub / github.com/jsdoc/jsdoc / attachModuleSymbols

Function attachModuleSymbols

templates/default/publish.js:274–300  ·  view source on GitHub ↗

* Look for classes or functions with the same name as modules (which indicates that the module * exports only that class or function), then attach the classes or functions to the `module` * property of the appropriate module doclets. The name of each class or function is also updated * for displa

(doclets, modules)

Source from the content-addressed store, hash-verified

272 * @param {Array.<module:jsdoc/doclet.Doclet>} modules - The array of module doclets to search.
273 */
274function attachModuleSymbols(doclets, modules) {
275 const symbols = {};
276
277 // build a lookup table
278 doclets.forEach(symbol => {
279 symbols[symbol.longname] = symbols[symbol.longname] || [];
280 symbols[symbol.longname].push(symbol);
281 });
282
283 modules.forEach(module => {
284 if (symbols[module.longname]) {
285 module.modules = symbols[module.longname]
286 // Only show symbols that have a description. Make an exception for classes, because
287 // we want to show the constructor-signature heading no matter what.
288 .filter(({description, kind}) => description || kind === 'class')
289 .map(symbol => {
290 symbol = doop(symbol);
291
292 if (symbol.kind === 'class' || symbol.kind === 'function') {
293 symbol.name = `${symbol.name.replace('module:', '(require("')}"))`;
294 }
295
296 return symbol;
297 });
298 }
299 });
300}
301
302function buildMemberNav(items, itemHeading, itemsSeen, linktoFn) {
303 let nav = '';

Callers 1

publish.jsFile · 0.85

Calls 1

doopFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…