react-addons-text-content
Version:
Like DOM API's `Node.textContent` and it works in React Element
1 lines • 306 B
JavaScript
;function getText(r){var e="",t=function n(r){if("string"==typeof r||"number"==typeof r)e+=r;else if(Array.isArray(r))r.forEach(function(r){return n(r)});else if(r&&r.props){var t=r.props.children;Array.isArray(t)?t.forEach(function(r){return n(r)}):n(t)}};return t(r),e}module.exports=getText;