MCPcopy Create free account
hub / github.com/adobe/react-spectrum / extractText

Function extractText

packages/dev/s2-docs/scripts/generateMarkdownDocs.mjs:2730–2745  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2728
2729 // Extract text content from children
2730 const extractText = children => {
2731 if (!children) {
2732 return '';
2733 }
2734 return children
2735 .map(child => {
2736 if (child.type === 'text' || child.type === 'mdxText') {
2737 return child.value;
2738 }
2739 if (child.children) {
2740 return extractText(child.children);
2741 }
2742 return '';
2743 })
2744 .join('');
2745 };
2746
2747 const childrenText = extractText(node.children);
2748 const linkText = ariaLabel || childrenText || href;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected