@octopusdeploy/design-system-components
Version:
The design systems component library.
15 lines (14 loc) • 501 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.flattenFragments = flattenFragments;
const react_1 = require("react");
const react_is_1 = require("react-is");
// Replaces fragments with an array of their children
function flattenFragments(children) {
return react_1.Children.map(children, (c) => {
if ((0, react_is_1.isFragment)(c)) {
return react_1.Children.toArray(c.props.children);
}
return c;
})?.flat(Infinity);
}