[常用函数]深拷贝
判断类型见:https://www.cnblogs.com/zhoulixue/p/17187385.html
// 深拷贝 export const deepclone = (source: any) => { if (getType(source) === 'Object') { return Object.keys(source).reduce((pre, curr) => { const res = pre; res[curr] = deepclone(source[curr]); return res; }, {}); } if (getType(source) === 'Array') { return source.map((x: any) => deepclone(x)); } if (getType(source) === 'Date') { return new Date(source); } if (getType(source) === 'RegExp') { return new RegExp(source.source, source.flags); } return source; };