mirror of
https://github.com/supabase/supabase.git
synced 2026-07-05 03:24:19 +08:00
16 lines
407 B
JavaScript
16 lines
407 B
JavaScript
export function flattenSections(sections) {
|
|
var a = []
|
|
for (var i = 0; i < sections.length; i++) {
|
|
if (sections[i].id) {
|
|
// only push a section that has an id
|
|
// these are reserved for sidebar subtitles
|
|
a.push(sections[i])
|
|
}
|
|
if (sections[i].items) {
|
|
// if there are subitems, loop through
|
|
a = a.concat(flattenSections(sections[i].items))
|
|
}
|
|
}
|
|
return a
|
|
}
|