export function deepClone(source) {
  if (!source && typeof source !== 'object') {
    throw new Error('error arguments', 'shallowClone');
  }
  const targetObj = source.constructor === Array ? [] : {};
  Object.keys(source).forEach((keys) => {
    if (source[keys] && typeof source[keys] === 'object') {
      targetObj[keys] = deepClone(source[keys]);
    } else {
      targetObj[keys] = source[keys];
    }
  });
  return targetObj;
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2022-01-26
  • 2021-11-27
  • 2021-12-01
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-14
  • 2018-12-10
  • 2022-12-23
  • 2022-12-23
  • 2021-04-02
  • 2021-12-17
  • 2022-12-23
相关资源
相似解决方案