--- // import SidebarSection from "./SidebarSection.astro"; import Logo from "./Logo.astro"; import glob from "fast-glob"; const paths = await glob('docs/**/*.md'); function isObject(obj) { return typeof obj === 'object' && obj !== null && obj !== undefined } // Capitalize first letter of each word let capitalize = (str) => { return str .replace(/-/g, " ") .replace(/\w\S*/g, (txt) => (txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()) ) .replace(/api/gi, "API") .replace(/css/gi, "CSS"); }; const obj = {}; function deepGet(obj, path) { var length = path.length; for (var i = 0; i < length; i++) { if (obj == null) return void 0; obj = obj[path[i]]; } return length ? obj : void 0; } function deepSet(obj, path, value) { var length = path.length; for (var i = 0; i < length; i++) { if (!isObject(obj[path[i]])) { obj[path[i]] = {}; } if (i == length - 1) { obj[path[i]] = value; } obj = obj[path[i]]; } return length ? obj : void 0; } paths.forEach(p => { let path = p.replace("docs/", "").replace(/\.md$/, ""); deepSet(obj, path.split("/"), "/" + path); }) ---