Extended utils for React.Children opaque data structure.
npm install --save react-children-utilities
Instead of requiring Children from React, require this one, it will extend existing capabilities from Children in your current React version.
var Children = require('react-children-utilities');
With ES6 modules
import Children from 'react-children-utilities';
Creates a new children array with all elements that pass the test implemented by the provided function.
Children.filter(children, callback)
Returns an object with keys that map each tag name to an array of children of that type, and a key that maps the rest of children.
Children.groupByType(children, tagNames[, restKey])
Creates a new children array with the results of calling a provided function on every element (and its children) in the provided children.
Children.deepMap(children, callback)
Executes a provided function on every element (and its children) in the provided children.
Children.deepForEach(children, callback)
Returns the first element in the children (and its children) that satisfies the provided testing function.
Children.deepFind(children, callback)
Strips all html and returns only text nodes
Children.onlyText(children)