UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

1 lines 642 B
{"version":3,"file":"get-single-element-child.mjs","names":[],"sources":["../../../../src/core/utils/get-single-element-child/get-single-element-child.ts"],"sourcesContent":["import { Children } from 'react';\nimport { isElement } from '../is-element/is-element';\n\nexport function getSingleElementChild(children: React.ReactNode) {\n const _children = Children.toArray(children);\n if (_children.length !== 1 || !isElement(_children[0])) {\n return null;\n }\n return _children[0];\n}\n"],"mappings":";;;;AAGA,SAAgB,sBAAsB,UAA2B;CAC/D,MAAM,YAAY,SAAS,QAAQ,SAAS;AAC5C,KAAI,UAAU,WAAW,KAAK,CAAC,UAAU,UAAU,GAAG,CACpD,QAAO;AAET,QAAO,UAAU"}