Home / Function/ flattenSections() — supabase Function Reference

flattenSections() — supabase Function Reference

Architecture documentation for the flattenSections() function in helpers.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  c746434f_93d1_b546_1ccf_f7913960723c["flattenSections()"]
  c3d996f0_61b0_53bd_3af4_926c4758f82e["getAvailableSectionIds()"]
  c3d996f0_61b0_53bd_3af4_926c4758f82e -->|calls| c746434f_93d1_b546_1ccf_f7913960723c
  style c746434f_93d1_b546_1ccf_f7913960723c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/lib/helpers.ts lines 48–62

export function flattenSections(sections: ICommonBase[]): ICommonSection[] {
  return sections.reduce<ICommonSection[]>((acc, section: ICommonItem) => {
    // Flatten sub-items
    if ('items' in section) {
      let newSections = acc

      if (section.type !== 'category') {
        newSections.push(section)
      }

      return newSections.concat(flattenSections(section.items))
    }
    return acc.concat(section)
  }, [])
}

Subdomains

Frequently Asked Questions

What does flattenSections() do?
flattenSections() is a function in the supabase codebase.
What calls flattenSections()?
flattenSections() is called by 1 function(s): getAvailableSectionIds.

Analyze Your Own Codebase

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

Try Supermodel Free