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

Function extractText

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

Source from the content-addressed store, hash-verified

2719
2720 // Extract text content from children
2721 const extractText = children => {
2722 if (!children) {
2723 return '';
2724 }
2725 return children
2726 .map(child => {
2727 if (child.type === 'text' || child.type === 'mdxText') {
2728 return child.value;
2729 }
2730 if (child.children) {
2731 return extractText(child.children);
2732 }
2733 return '';
2734 })
2735 .join('');
2736 };
2737
2738 const childrenText = extractText(node.children);
2739 const linkText = ariaLabel || childrenText || href;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected