// 去除数组里面为空的属性及子数组
export function deepCopy (source) {
var result = []
//var result = {}
for (var key in source) {
if (source[key] instanceof Array) {
if (source[key].length > 0) {
result[key] = typeof source[key] === 'object'
? deepCopy(source[key])
: source[key]
}
} else {
if (source[key]) {
result[key] = typeof source[key] === 'object'
? deepCopy(source[key])
: source[key]
}
}
}
return result
}

相关文章:

  • 2022-12-23
  • 2022-03-05
  • 2021-06-19
  • 2022-12-23
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2021-11-13
猜你喜欢
  • 2021-06-29
  • 2021-06-27
  • 2022-12-23
  • 2021-10-10
  • 2022-12-23
  • 2022-12-23
  • 2021-11-13
相关资源
相似解决方案