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
  a31526e8_63bf_6ec8_7695_4e206c5d427b["getItems()"]
  105f2cdd_370d_8bff_d040_9557c23677cf["getToc()"]
  105f2cdd_370d_8bff_d040_9557c23677cf -->|calls| a31526e8_63bf_6ec8_7695_4e206c5d427b
  f4487aac_52ed_8554_ff30_a91c5549ddf4["flattenNode()"]
  a31526e8_63bf_6ec8_7695_4e206c5d427b -->|calls| f4487aac_52ed_8554_ff30_a91c5549ddf4
  style a31526e8_63bf_6ec8_7695_4e206c5d427b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/learn/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 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