MCPcopy Create free account
hub / github.com/code-pushup/cli / flatten

Function flatten

packages/utils/src/lib/text-formats/ascii/tree.ts:106–114  ·  view source on GitHub ↗
(
  node: TreeNode,
  level = 0,
)

Source from the content-addressed store, hash-verified

104}
105
106function flatten(
107 node: TreeNode,
108 level = 0,
109): { node: TreeNode; level: number }[] {
110 return [
111 { node, level },
112 ...(node.children?.flatMap(child => flatten(child, level + 1)) ?? []),
113 ];
114}
115
116function coveragePercentage(coverage: number): string {
117 return (coverage * 100).toFixed(2);

Callers 1

formatAsciiTreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected