SOURCE

const dealObjectValue = (obj) => {
  const param = {}
  if (obj === null || obj === undefined || obj === '') return param
  Object.keys(obj).forEach((key) => {
    if (typeof (obj[key]) === 'object') {
      param[key] = dealObjectValue(obj[key])
    } else if (obj[key] !== null && obj[key] !== undefined && obj[key] !== '') {
      param[key] = obj[key]
    }
  })
  return param
}

const obj = {a: 1,b: "",c: [name, 'zyz']}
console.log(dealObjectValue(obj))
console 命令行工具 X clear

                    
>
console