MCPcopy Index your code
hub / github.com/fontsource/fontsource / getNodeText

Function getNodeText

website/app/components/code/Code.tsx:37–47  ·  view source on GitHub ↗
(node: ReactNode)

Source from the content-addressed store, hash-verified

35};
36
37const getNodeText = (node: ReactNode): string => {
38 if (typeof node === 'string' || typeof node === 'number') return String(node);
39
40 if (Array.isArray(node)) return node.map(getNodeText).join('');
41
42 if (isValidElement<ElementWithCodeProps>(node)) {
43 return getNodeText(node.props.children);
44 }
45
46 return '';
47};
48
49const getLanguageFromClassName = (className?: string) =>
50 className

Callers 1

CodePreFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected