UNPKG

one

Version:

One is a React framework for web, iOS, and Android apps.

42 lines (40 loc) • 999 B
function filterRootHTML(el) { let htmlProps; let bodyProps; let head; function traverse(element) { if (!element || typeof element !== "object") return element; if (Array.isArray(element)) return element.map(traverse); const reactElement = element; const { type, props } = reactElement; if (type === "html") { if (props && typeof props === "object" && "children" in props) { const { children: children2, ...restProps } = props; htmlProps = restProps; return traverse(children2); } return null; } if (type === "head") { head = reactElement; return null; } if (type === "body") { if (props && typeof props === "object" && "children" in props) { const { children: children2, ...restProps } = props; bodyProps = restProps; return children2; } return null; } return element; } return { children: traverse(el) || el, htmlProps, bodyProps, head }; } export { filterRootHTML }; //# sourceMappingURL=filterRootHTML.mjs.map