MCPcopy Index your code
hub / github.com/developit/microbundle / printTree

Function printTree

test/index.test.js:15–27  ·  view source on GitHub ↗
(nodes, indentLevel = 0)

Source from the content-addressed store, hash-verified

13const join = (arr, delimiter = '') => arr.join(delimiter);
14
15const printTree = (nodes, indentLevel = 0) => {
16 const indent = ' '.repeat(indentLevel);
17 return join(
18 nodes
19 .filter(node => node.name[0] !== '.')
20 .map(node => {
21 const isDir = node.type === 'directory';
22 return `${indent}${node.name}\n${
23 isDir ? printTree(node.children, indentLevel + 1) : ''
24 }`;
25 }),
26 );
27};
28
29describe('fixtures', () => {
30 const dirs = fs

Callers 1

index.test.jsFile · 0.85

Calls 1

joinFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…