Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/scripts/generate-sidebar.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ function getConceptDisplayName(section) {
);
}

function kebabToCamel(str) {
return str.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
}

function generateSidebar() {
const sidebar = {};

Expand Down Expand Up @@ -226,7 +230,7 @@ function generateSidebar() {
// Add use-fake-timers as first item after Introduction
if (rootFiles.includes("use-fake-timers.md")) {
sectionItems.push({
text: "use fake timers",
text: "useFakeTimers",
link: "/concepts/fake-timers/use-fake-timers",
collapsed: false
});
Expand All @@ -240,7 +244,7 @@ function generateSidebar() {
const apiItems = remainingItems.map((f) => {
const name = f.replace(".md", "");
return {
text: name.replace(/-/g, " "),
text: kebabToCamel(name),
link: `/concepts/fake-timers/${name}`
};
});
Expand Down
Loading