import { ComparisonLevel } from "@/types/components/loyalty/blocks" export function getHighestLevel(levels: ComparisonLevel[]) { return levels.reduce( (acc: ComparisonLevel | null, level: ComparisonLevel) => { if (!acc) { return level } return level.level > acc.level ? level : acc }, null ) }