@douyinfe/semi-ui
Version:
A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.
14 lines • 433 B
JavaScript
import _isPlainObject from "lodash/isPlainObject";
import _cloneDeepWith from "lodash/cloneDeepWith";
import React from 'react';
export function cloneDeep(treeNodeList) {
return _cloneDeepWith(treeNodeList, val => {
// only clone treeNode inner data and skip user data
if (_isPlainObject(val) && !val._innerDataTag) {
return val;
}
if (/*#__PURE__*/React.isValidElement(val)) {
return val;
}
});
}