import { type User } from 'src/types/user';

/** Same people selected (order-insensitive). */
export function areUserSelectionsEqualById(a: User[], b: User[]) {
  if (a.length !== b.length) return false;
  const idsA = a.map(u => u.id).toSorted((x, y) => x - y);
  const idsB = b.map(u => u.id).toSorted((x, y) => x - y);
  return idsA.every((id, i) => id === idsB[i]);
}
