@builder.io/mitosis
Version:
Write components once, run everywhere. Compiles to Vue, React, Solid, and Liquid. Import code from Figma and Builder.io
23 lines (22 loc) • 917 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseChildren = exports.filterChildren = void 0;
const html_1 = require("../html");
function filterChildren(children) {
var _a;
return ((_a = children === null || children === void 0 ? void 0 : children.filter((n) => { var _a; return n.type !== 'Comment' && (n.type !== 'Text' || ((_a = n.data) === null || _a === void 0 ? void 0 : _a.trim().length)); })) !== null && _a !== void 0 ? _a : []);
}
exports.filterChildren = filterChildren;
function parseChildren(json, node) {
const children = [];
if (node.children) {
for (const child of filterChildren(node.children)) {
const mitosisNode = (0, html_1.parseHtmlNode)(json, child);
if (mitosisNode) {
children.push(mitosisNode);
}
}
}
return children;
}
exports.parseChildren = parseChildren;
;