import { isValidElement } from "react"; export const deepCopy = inObject => { let value; let key; if ( typeof inObject !== "object" || inObject === null || /** ReactNode 元素不 COPY,https://git.woa.com/tea-design/tea2/issues/514 */ isValidElement(inObject) ) { return inObject; } const outObject = Array.isArray(inObject) ? [] : {}; // eslint-disable-next-line guard-for-in for (key in inObject) { value = inObject[key]; outObject[key] = deepCopy(value); } return outObject; };