MCPcopy Index your code
hub / github.com/Bytez-com/docs / childrenToString

Method childrenToString

docs/scripts/generatePages/Component.js:27–53  ·  view source on GitHub ↗
(indent, depth)

Source from the content-addressed store, hash-verified

25 }
26
27 childrenToString(indent, depth) {
28 const childStrings = [];
29
30 const nextDepth = depth + 1;
31
32 const stringChildIndents = Array(indent * nextDepth)
33 .fill('\t')
34 .join('');
35
36 for (const child of this.children) {
37 if (child.constructor.name === 'String') {
38 const lines = child.split('\n');
39
40 const indentedString = lines.map((line) => `${stringChildIndents}${line}`).join('\n');
41
42 childStrings.push(indentedString);
43 continue;
44 }
45
46 const childString = child.toString(indent, nextDepth);
47 childStrings.push(childString);
48 }
49
50 const string = childStrings.join('\n');
51
52 return string;
53 }
54}
55
56module.exports = { Component };

Callers 1

toStringMethod · 0.95

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected