@wordpress/components
Version:
UI components for WordPress.
8 lines (7 loc) • 843 B
Source Map (JSON)
{
"version": 3,
"sources": ["../../src/utils/get-valid-children.ts"],
"sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { Children, isValidElement } from '@wordpress/element';\n\n/**\n * Gets a collection of available children elements from a React component's children prop.\n *\n * @param children\n *\n * @return An array of available children.\n */\nexport function getValidChildren(children) {\n if (typeof children === 'string') {\n return [children];\n }\n return Children.toArray(children).filter(child => isValidElement(child));\n}"],
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,qBAAyC;AASlC,SAAS,iBAAiB,UAAU;AACzC,MAAI,OAAO,aAAa,UAAU;AAChC,WAAO,CAAC,QAAQ;AAAA,EAClB;AACA,SAAO,wBAAS,QAAQ,QAAQ,EAAE,OAAO,eAAS,+BAAe,KAAK,CAAC;AACzE;",
"names": []
}