{"ast":null,"code":"import React from 'react';\n/**\n * Iterates through children that are typically specified as `props.children`,\n * but only maps over children that are \"valid elements\".\n *\n * The mapFunction provided index will be normalised to the components mapped,\n * so an invalid component would not increase the index.\n *\n */\n\nfunction map(children, func) {\n var index = 0;\n return React.Children.map(children, function (child) {\n return React.isValidElement(child) ? func(child, index++) : child;\n });\n}\n/**\n * Iterates through children that are \"valid elements\".\n *\n * The provided forEachFunc(child, index) will be called for each\n * leaf child with the index reflecting the position relative to \"valid components\".\n */\n\n\nfunction forEach(children, func) {\n var index = 0;\n React.Children.forEach(children, function (child) {\n if (React.isValidElement(child)) func(child, index++);\n });\n}\n\nexport { map, forEach };","map":null,"metadata":{},"sourceType":"module"}