function copyObject(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] = copyObject(source[keys])
    } else {
      targetObj[keys] = source[keys]
    }
  })
  return targetObj
}
/**
 * This is just a simple version of deep copy
 * Has a lot of edge cases bug
 * If you want to use a perfect deep copy, use lodash's _.cloneDeep
 */
This is just a simple version of deep copy
Has a lot of edge cases bug
If you want to use a perfect deep copy, use lodash's _.cloneDeep
This is just a simple version of deep copy Has a lot of edge cases bug If you want to use a perfect deep copy use lodash ' s _ . cloneDeep
function copyObject(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] = copyObject(source[keys])
    } else {
      targetObj[keys] = source[keys]
    }
  })
  return targetObj
}
function copyObject ( 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 ] = copyObject ( source [ keys ] ) } else { targetObj [ keys ] = source [ keys ] } } ) return targetObj }
This is just a simple version of deep copy
 Has a lot of edge cases bug
 If you want to use a perfect deep copy, use lodash's _.cloneDeep
This is just a simple version of deep copy Has a lot of edge cases bug If you want to use a perfect deep copy use lodash ' s _ . cloneDeep