MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / extractText

Function extractText

packages/react/src/components/markdown.tsx:19–27  ·  view source on GitHub ↗
(node: ReactNode)

Source from the content-addressed store, hash-verified

17}
18
19function extractText(node: ReactNode): string {
20 if (typeof node === "string") return node;
21 if (typeof node === "number") return String(node);
22 if (Array.isArray(node)) return node.map(extractText).join("");
23 if (isValidElement(node) && node.props) {
24 return extractText((node.props as { children?: ReactNode }).children);
25 }
26 return "";
27}
28
29function PreBlock(
30 props: ComponentPropsWithoutRef<"pre"> & { children?: ReactNode; node?: unknown },

Callers 1

PreBlockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected