(root: PathTreeNode)
| 138 | } |
| 139 | |
| 140 | function topLevelNodes(root: PathTreeNode): PathTreeNode[] { |
| 141 | const children = [...root.children.values()]; |
| 142 | const onlyChild = children.length === 1 ? children[0] : undefined; |
| 143 | if (onlyChild && onlyChild.name === '/' && onlyChild.children.size > 1) { |
| 144 | return [...onlyChild.children.values()]; |
| 145 | } |
| 146 | return children; |
| 147 | } |
| 148 | |
| 149 | export function formatPathTree( |
| 150 | entries: readonly PathTreeEntry[], |