UNPKG

@salesforce/design-system-react

Version:

Salesforce Lightning Design System for React

25 lines (20 loc) 554 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = textContent; function textContentArray(child) { var text = []; if (typeof child === 'string' || typeof child === 'number') { text.push(child); } else if (Array.isArray(child)) { text.push(child.forEach(textContentArray)); } else if (child && child.props) { var children = child.props.children; text.push(textContentArray(children)); } return text; } function textContent(child) { return textContentArray(child).join(''); }