Home / Function/ getItems() — ui Function Reference

getItems() — ui Function Reference

Architecture documentation for the getItems() function in toc.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  b8a67de8_cd12_9398_3f13_642e9b187213["getItems()"]
  6b69cecd_f6b0_5bf0_19b4_7a9032d5992d["toc.ts"]
  b8a67de8_cd12_9398_3f13_642e9b187213 -->|defined in| 6b69cecd_f6b0_5bf0_19b4_7a9032d5992d
  ab0af873_ee0e_b9fd_5588_3ff6e1e9e635["getToc()"]
  ab0af873_ee0e_b9fd_5588_3ff6e1e9e635 -->|calls| b8a67de8_cd12_9398_3f13_642e9b187213
  b6c6b21d_cdeb_f4ad_4321_3ad4b023b927["flattenNode()"]
  b8a67de8_cd12_9398_3f13_642e9b187213 -->|calls| b6c6b21d_cdeb_f4ad_4321_3ad4b023b927
  style b8a67de8_cd12_9398_3f13_642e9b187213 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

deprecated/www/lib/toc.ts lines 29–64

function getItems(node, current): Items {
  if (!node) {
    return {}
  }

  if (node.type === "paragraph") {
    visit(node, (item) => {
      if (item.type === "link") {
        current.url = item.url
        current.title = flattenNode(node)
      }

      if (item.type === "text") {
        current.title = flattenNode(node)
      }
    })

    return current
  }

  if (node.type === "list") {
    current.items = node.children.map((i) => getItems(i, {}))

    return current
  } else if (node.type === "listItem") {
    const heading = getItems(node.children[0], {})

    if (node.children.length > 1) {
      getItems(node.children[1], heading)
    }

    return heading
  }

  return {}
}

Subdomains

Called By

Frequently Asked Questions

What does getItems() do?
getItems() is a function in the ui codebase, defined in deprecated/www/lib/toc.ts.
Where is getItems() defined?
getItems() is defined in deprecated/www/lib/toc.ts at line 29.
What does getItems() call?
getItems() calls 1 function(s): flattenNode.
What calls getItems()?
getItems() is called by 1 function(s): getToc.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free