@pronto-tools-and-more/components-renderer 10.29.0 → 10.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -3,6 +3,9 @@ import * as HasComplexChildren from "../HasComplexChildren/HasComplexChildren.js
|
|
3
3
|
import * as RenderCustomElement from "../RenderCustomElement/RenderCustomElement.js";
|
4
4
|
|
5
5
|
export const renderElement = (element) => {
|
6
|
+
if (!element) {
|
7
|
+
return null;
|
8
|
+
}
|
6
9
|
if (typeof element === "string") {
|
7
10
|
return {
|
8
11
|
type: "html",
|
@@ -21,7 +24,7 @@ export const renderElement = (element) => {
|
|
21
24
|
}
|
22
25
|
const hasComplexChildren = HasComplexChildren.hasComplexChildren(element);
|
23
26
|
const renderedChildren = hasComplexChildren
|
24
|
-
? element.children.map(renderElement)
|
27
|
+
? element.children.map(renderElement).filter(Boolean)
|
25
28
|
: [];
|
26
29
|
const content = hasComplexChildren ? "" : element.children[0] || "";
|
27
30
|
const props = element.props ? element.props : {};
|