UNPKG

react-translate-maker

Version:

React translation module. Internationalize your great project.

37 lines (29 loc) 775 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = children; var _react = require("react"); function replaceReactChildren(children, value) { if (!(0, _react.isValidElement)(children)) { return children; } return _react.Children.map(children, child => { if (!(0, _react.isValidElement)(child)) { return child; } const { props } = child; 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