export function sortMenusByPriority(menus = []) {
  menus.sort((a, b) => {
    if (a.oldBrotherPath === b.oldBrotherPath) {
      return b.priority - a.priority;
    }
  });
  //
  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;
}
