MCPcopy
hub / github.com/BuilderIO/mitosis / isRootTextNode

Function isRootTextNode

packages/core/src/helpers/is-root-text-node.ts:4–7  ·  view source on GitHub ↗
(json: MitosisComponent | MitosisNode)

Source from the content-addressed store, hash-verified

2import { MitosisNode } from '../types/mitosis-node';
3
4export function isRootTextNode(json: MitosisComponent | MitosisNode) {
5 const firstChild = json.children[0];
6 return Boolean(json.children.length === 1 && firstChild && isTextNode(firstChild));
7}
8
9export function isTextNode(node: MitosisNode) {
10 return Boolean(node.properties._text || node.bindings._text);

Callers 5

componentToMitosisFunction · 0.90
FragmentFunction · 0.90
ShowFunction · 0.90
_componentToReactFunction · 0.90
componentToSolidFunction · 0.90

Calls 1

isTextNodeFunction · 0.70

Tested by

no test coverage detected