mirror of
https://github.com/noodlapp/noodl-docs.git
synced 2026-01-11 14:52:54 +01:00
Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com> Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com> Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com> Co-Authored-By: Michael Cartner <32543275+michaelcartner@users.noreply.github.com>
19 lines
437 B
JavaScript
19 lines
437 B
JavaScript
function recursiveBuildSidebarData(item) {
|
|
if ('items' in item) {
|
|
// is a category
|
|
return {
|
|
type: 'category',
|
|
label: item.label,
|
|
items: item.items.map(recursiveBuildSidebarData),
|
|
}
|
|
} else {
|
|
return {
|
|
type: 'doc',
|
|
label: item.label,
|
|
id: item.id,
|
|
}
|
|
}
|
|
}
|
|
|
|
exports.recursiveBuildSidebarData = recursiveBuildSidebarData
|