type SubItems = {
  name: string;
  path: string;
  component: () => React.ComponentType | any;
};

type Item = {
  page_name: string;
  [key: string]: any;
};

export function filterByAccess(
  permissions: Item[] = [],
  items: SubItems[]
): Item[] {
  const nameSet = new Set(items.map((item) => item.name));
  return permissions.filter((obj) => nameSet.has(obj.page_name));
}
