MCPcopy Index your code
hub / github.com/developit/htm / transform

Function transform

packages/babel-plugin-htm/index.mjs:162–172  ·  view source on GitHub ↗
(node, state)

Source from the content-addressed store, hash-verified

160 }
161
162 function transform(node, state) {
163 if (t.isNode(node)) return node;
164 if (typeof node === 'string') return stringValue(node);
165 if (typeof node === 'undefined') return t.identifier('undefined');
166
167 const { tag, props, children } = node;
168 const newTag = typeof tag === 'string' ? t.stringLiteral(tag) : tag;
169 const newProps = spreadNode(props, state);
170 const newChildren = t.arrayExpression(children.map(child => transform(child, state)));
171 return createVNode(newTag, newProps, newChildren);
172 }
173
174 // The tagged template tag function name we're looking for.
175 // This is static because it's generally assigned via htm.bind(h),

Callers 3

TaggedTemplateExpressionFunction · 0.85
compileFunction · 0.85
babel.test.mjsFile · 0.85

Calls 3

stringValueFunction · 0.85
spreadNodeFunction · 0.85
createVNodeFunction · 0.85

Tested by 1

compileFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…