/*
 * @Author: aliyun0758874076 2300202994@qq.com
 * @Date: 2023-09-16 14:38:57
 * @LastEditors: aliyun0758874076 2300202994@qq.com
 * @LastEditTime: 2023-09-17 18:04:48
 * @FilePath: \jufeng-pc-settle\src\util\ArrayFunction.js 用于书写处理数组的方法
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
export const unemptyArray = function (arr = []) {
  for (var i = 0; i < arr.length; i++) {
    if (arr[i].children.length < 1) {
      // children若为空数组，则将children设为undefined
      arr[i].children = undefined
    } else {
      // children若不为空数组，则继续 递归调用 本方法
      unemptyArray(arr[i].children)
    }
  }
  return arr
}

export const formatDate = (now) => { // 时间戳转日期格式
  let year = now.getFullYear()
  let month = now.getMonth() + 1
  let date = now.getDate()
  return year + '-' + month + '-' + date
}
