MCPcopy Create free account
hub / github.com/developit/htm / processChildren

Function processChildren

packages/babel-plugin-transform-jsx-to-htm/index.mjs:109–149  ·  view source on GitHub ↗
(node, name, isFragment)

Source from the content-addressed store, hash-verified

107 }
108
109 function processChildren(node, name, isFragment) {
110 const children = t.react.buildChildren(node);
111 if (children && children.length !== 0) {
112 if (!isFragment) {
113 raw('>');
114 }
115 for (let i = 0; i < children.length; i++) {
116 let child = children[i];
117 if (t.isStringLiteral(child)) {
118 escapeText(child.value);
119 }
120 else if (t.isJSXElement(child)) {
121 processNode(child);
122 }
123 else {
124 expr(child);
125 }
126 }
127
128 if (!isFragment) {
129 if (isComponentName(name)) {
130 if (terse) {
131 raw('<//>');
132 }
133 else {
134 raw('</');
135 expr(name);
136 raw('>');
137 }
138 }
139 else {
140 raw('</');
141 raw(name.name);
142 raw('>');
143 }
144 }
145 }
146 else if (!isFragment) {
147 raw('/>');
148 }
149 }
150
151 function processNode(node, path, isRoot) {
152 const open = node.openingElement;

Callers 2

processNodeFunction · 0.85
jsxVisitorHandlerFunction · 0.85

Calls 5

rawFunction · 0.85
escapeTextFunction · 0.85
processNodeFunction · 0.85
exprFunction · 0.85
isComponentNameFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…