MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / sortTree

Function sortTree

packages/web/src/features/git/utils.ts:80–93  ·  view source on GitHub ↗
(node: FileTreeNode)

Source from the content-addressed store, hash-verified

78 }
79
80 const sortTree = (node: FileTreeNode): FileTreeNode => {
81 if (node.type === 'blob') {
82 return node;
83 }
84
85 const sortedChildren = node.children
86 .map(sortTree)
87 .sort(compareFileTreeItems);
88
89 return {
90 ...node,
91 children: sortedChildren,
92 };
93 };
94
95 return sortTree(root);
96}

Callers 1

buildFileTreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected