Home / Function/ getItems() — supabase Function Reference

getItems() — supabase Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  8b0bfea1_74ef_b2d4_ce59_98e7400596cd["getItems()"]
  b9d6284c_da44_e786_f333_093f31cfa7c2["getToc()"]
  b9d6284c_da44_e786_f333_093f31cfa7c2 -->|calls| 8b0bfea1_74ef_b2d4_ce59_98e7400596cd
  47ff6c74_1fe2_b909_c767_017b24b6557d["flattenNode()"]
  8b0bfea1_74ef_b2d4_ce59_98e7400596cd -->|calls| 47ff6c74_1fe2_b909_c767_017b24b6557d
  style 8b0bfea1_74ef_b2d4_ce59_98e7400596cd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/design-system/lib/toc.ts lines 28–63

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 {}
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does getItems() do?
getItems() is a function in the supabase codebase.
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