react-translate-maker
Version:
React translation module. Internationalize your great project.
33 lines (25 loc) • 735 B
JavaScript
;
exports.__esModule = true;
exports.default = children;
var _react = require("react");
function replaceReactChildren(children, value) {
if (!(0, _react.isValidElement)(children)) {
return children;
}
return _react.Children.map(children, function (child) {
if (!(0, _react.isValidElement)(child)) {
return child;
}
var props = child.props;
if (props && props.children === '#') {
return (0, _react.cloneElement)(child, {
children: value
});
}
return replaceReactChildren(child, value);
});
}
function children(value, part, attrs, metadata, newChildrenValue) {
return replaceReactChildren(value, newChildrenValue);
}
//# sourceMappingURL=children.js.map