MCPcopy Create free account
hub / github.com/arctic-cli/interface / sort

Function sort

packages/arctic/src/file/ripgrep.ts:294–303  ·  view source on GitHub ↗
(node: Node)

Source from the content-addressed store, hash-verified

292 }
293
294 function sort(node: Node) {
295 node.children.sort((a, b) => {
296 if (!a.children.length && b.children.length) return 1
297 if (!b.children.length && a.children.length) return -1
298 return a.path.at(-1)!.localeCompare(b.path.at(-1)!)
299 })
300 for (const child of node.children) {
301 sort(child)
302 }
303 }
304 sort(root)
305
306 let current = [root]

Callers 1

treeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected