Skip to content

Commit ccec999

Browse files
committed
rename sorting func
1 parent 8aab1f7 commit ccec999

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/docTree.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export function nodeForPath(node: DocNode, path: string | string[]): DocNode | u
154154
* @returns The next DocNode in the tree, or undefined if there is no next node
155155
*/
156156
export const getNextNode = (node: DocNode): DocNode | undefined => {
157-
const children = node.children.filter(filterVisibleSiblings).sort(sortSiblingsByOrder);
157+
const children = node.children.filter(filterVisibleSiblings).sort(sortBySidebarOrder);
158158
// Check for children first
159159
if (
160160
children.length > 0 &&
@@ -211,7 +211,7 @@ const getNextSiblingNode = (node: DocNode): DocNode | undefined => {
211211
}
212212

213213
const siblings = node.parent.children
214-
.sort(sortSiblingsByOrder)
214+
.sort(sortBySidebarOrder)
215215
.filter(filterVisibleSiblings);
216216

217217
const index = siblings.indexOf(node);
@@ -228,7 +228,7 @@ const getPreviousSiblingNode = (node: DocNode): DocNode | undefined => {
228228
}
229229

230230
const siblings = node.parent.children
231-
.sort(sortSiblingsByOrder)
231+
.sort(sortBySidebarOrder)
232232
.filter(filterVisibleSiblings);
233233

234234
const index = siblings.indexOf(node);
@@ -239,7 +239,7 @@ const getPreviousSiblingNode = (node: DocNode): DocNode | undefined => {
239239
return undefined;
240240
};
241241

242-
const sortSiblingsByOrder = (a: DocNode, b: DocNode) =>
242+
const sortBySidebarOrder = (a: DocNode, b: DocNode) =>
243243
(a.frontmatter.sidebar_order ?? 10) - (b.frontmatter.sidebar_order ?? 10);
244244

245245
const filterVisibleSiblings = (s: DocNode) =>

0 commit comments

Comments
 (0)