export function sortMenusByPriority(menus = []) {
  // console.log(menus);
  menus.sort((a, b) => {
    if (a.oldBrotherPath === b.oldBrotherPath) {
      return b.priority - a.priority;
    }
  });
  // console.log(menus);
  //
  return menus;
}

export function diGuiSortMenus(menus = []) {
  if(menus && Array.isArray(menus) && menus.length >= 2){
    menus = sortMenusByPriority(menus);
  }
  for (let item of menus) {
    if (Array.isArray(item.children) && item.children.length >= 2) {
      diGuiSortMenus(item.children);
    }
  }
  return menus;
}
