docs: sort API reference sidebar items and sections (#12032)

This commit is contained in:
Shahed Nasser
2025-03-28 17:19:28 +02:00
committed by GitHub
parent acdcb11947
commit 9c90a39f1c
5 changed files with 99 additions and 23 deletions

View File

@@ -0,0 +1,33 @@
export const getMethodOrder = (method: string) => {
switch (method) {
case "get":
return 1
case "post":
return 2
case "delete":
return 3
default:
return 4
}
}
export const compareOperations = ({
httpMethodA,
httpMethodB,
summaryA,
summaryB,
}: {
httpMethodA: string
httpMethodB: string
summaryA: string
summaryB: string
}) => {
const aOrder = getMethodOrder(httpMethodA)
const bOrder = getMethodOrder(httpMethodB)
if (aOrder !== bOrder) {
return aOrder - bOrder
}
return summaryA.localeCompare(summaryB)
}