MCPcopy Index your code
hub / github.com/nodejs/node / shouldAppearInPrimaryNavBarMenu

Function shouldAppearInPrimaryNavBarMenu

test/fixtures/snapshot/typescript.js:141407–141445  ·  view source on GitHub ↗

Determines if a node should appear in the primary navbar menu.

(item)

Source from the content-addressed store, hash-verified

141405 return primaryNavBarMenuItems;
141406 /** Determines if a node should appear in the primary navbar menu. */
141407 function shouldAppearInPrimaryNavBarMenu(item) {
141408 // Items with children should always appear in the primary navbar menu.
141409 if (item.children) {
141410 return true;
141411 }
141412 // Some nodes are otherwise important enough to always include in the primary navigation menu.
141413 switch (navigationBarNodeKind(item)) {
141414 case 257 /* SyntaxKind.ClassDeclaration */:
141415 case 226 /* SyntaxKind.ClassExpression */:
141416 case 260 /* SyntaxKind.EnumDeclaration */:
141417 case 258 /* SyntaxKind.InterfaceDeclaration */:
141418 case 261 /* SyntaxKind.ModuleDeclaration */:
141419 case 305 /* SyntaxKind.SourceFile */:
141420 case 259 /* SyntaxKind.TypeAliasDeclaration */:
141421 case 345 /* SyntaxKind.JSDocTypedefTag */:
141422 case 338 /* SyntaxKind.JSDocCallbackTag */:
141423 return true;
141424 case 214 /* SyntaxKind.ArrowFunction */:
141425 case 256 /* SyntaxKind.FunctionDeclaration */:
141426 case 213 /* SyntaxKind.FunctionExpression */:
141427 return isTopLevelFunctionDeclaration(item);
141428 default:
141429 return false;
141430 }
141431 function isTopLevelFunctionDeclaration(item) {
141432 if (!item.node.body) {
141433 return false;
141434 }
141435 switch (navigationBarNodeKind(item.parent)) {
141436 case 262 /* SyntaxKind.ModuleBlock */:
141437 case 305 /* SyntaxKind.SourceFile */:
141438 case 169 /* SyntaxKind.MethodDeclaration */:
141439 case 171 /* SyntaxKind.Constructor */:
141440 return true;
141441 default:
141442 return false;
141443 }
141444 }
141445 }
141446 }
141447 function convertToTree(n) {
141448 return {

Callers 1

recurFunction · 0.85

Calls 2

navigationBarNodeKindFunction · 0.85

Tested by

no test coverage detected