SOURCE

function filterParams(obj) {
  const keys = Object.keys(obj)
  keys.forEach(key => {
    const value = obj[key]
    if (isObject(value)) filterParams(value)
    if (isEmpty(value)) delete obj[key]
  })
  return obj
}

function isEmpty(input) {
  return [, undefined, null].includes(input)
}

function isObject(input) {
  return input !== null && (!Array.isArray(input)) && typeof input ===  object 
}
console 命令行工具 X clear

                    
>
console