react-inky
Version:
React components for Inky
25 lines (20 loc) • 573 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = containsRow;
var _react = require("react");
/**
* Determine if a collection of React elements contains a `<Row />`.
* @param {ReactElement[]} children - Elements to check.
* @returns {Boolean} If collection contains a `<Row />`;
*/
function containsRow(children) {
let hasRow = false;
_react.Children.forEach(children, child => {
if (child && typeof child.type === 'function' && child.type.name === 'Row') {
hasRow = true;
}
});
return hasRow;
}