Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️
PHP attendize-alternativedoor-managementevent-check-inevent-managementevent-registrationevent-ticketingeventbrite-alternativeeventslaravelopen-sourcephpreactself-hostedsell-ticketssell-tickets-onlineticket-sellingticketing-systemtickettailor-alternativetito-alternative
export interface ConsecutiveGroup<T> {
key: string;
items: T[];
}
export const groupConsecutive = <T>(items: T[], keyOf: (item: T) => string): ConsecutiveGroup<T>[] =>
items.reduce<ConsecutiveGroup<T>[]>((groups, item) => {
const key = keyOf(item);
const last = groups[groups.length - 1];
if (last?.key === key) {
last.items.push(item);
} else {
groups.push({key, items: [item]});
}
return groups;
}, []);