(node: React.ReactNode)
| 179 | } |
| 180 | |
| 181 | export function getReactNodeText(node: React.ReactNode): string { |
| 182 | if (typeof node === "string" || typeof node === "number") { |
| 183 | return String(node); |
| 184 | } |
| 185 | |
| 186 | if (Array.isArray(node)) { |
| 187 | return node.map(getReactNodeText).join(""); |
| 188 | } |
| 189 | |
| 190 | if (React.isValidElement<{ children?: React.ReactNode }>(node)) { |
| 191 | return getReactNodeText(node.props.children); |
| 192 | } |
| 193 | |
| 194 | return ""; |
| 195 | } |
no outgoing calls
no test coverage detected