MCPcopy
hub / github.com/unjs/consola / formatTree

Function formatTree

src/utils/tree.ts:60–73  ·  view source on GitHub ↗
(items: TreeItem[], options?: TreeOptions)

Source from the content-addressed store, hash-verified

58 * @returns {string} The formatted tree as a string, ready for printing to the console or elsewhere.
59 */
60export function formatTree(items: TreeItem[], options?: TreeOptions): string {
61 options = {
62 prefix: " ",
63 ellipsis: "...",
64 ...options,
65 };
66
67 const tree = _buildTree(items, options).join("");
68 if (options && options.color) {
69 return colorize(options.color, tree);
70 }
71
72 return tree;
73}
74
75function _buildTree(items: TreeItem[], options?: TreeOptions): string[] {
76 const chunks: string[] = [];

Callers 1

mainFunction · 0.90

Calls 2

colorizeFunction · 0.90
_buildTreeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…