All files / packages/app/features/receipt-components utils.ts

100% Statements 5/5
100% Branches 2/2
100% Functions 1/1
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15        88x       35285x 35285x 1547x   34606x    
import type { Participant } from "~app/hooks/use-participants";
 
import type { Item } from "./state";
 
export const SORT_USERS = (
	a: Item["consumers"][number] | Participant,
	b: Item["consumers"][number] | Participant,
) => {
	const delta = Temporal.ZonedDateTime.compare(a.createdAt, b.createdAt);
	if (delta === 0) {
		return a.peerId.localeCompare(b.peerId);
	}
	return delta;
};