MCPcopy Create free account
hub / github.com/block/buzz / getReactNodeText

Function getReactNodeText

desktop/src/shared/ui/markdown/utils.ts:181–195  ·  view source on GitHub ↗
(node: React.ReactNode)

Source from the content-addressed store, hash-verified

179}
180
181export 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}

Callers 2

createMarkdownComponentsFunction · 0.90
getCodeBlockTextFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected