(child: any)
| 36 | } |
| 37 | |
| 38 | function childToText(child: any): string { |
| 39 | if (typeof child === "string") { |
| 40 | return child; |
| 41 | } else if (child?.props) { |
| 42 | return childToText(child.props?.children); |
| 43 | } else if (Array.isArray(child)) { |
| 44 | return childrenToText(child); |
| 45 | } else { |
| 46 | return ""; |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | export function childrenToText(children: any) { |
| 51 | return children.map((child: any) => childToText(child)).join(""); |
no test coverage detected