Files
djhackersdev_minime/src/chunithm/handler/_util.ts
T
Tau d1d63e1ef9 chunithm: Initial implementation code drop
No cleaner development history than this exists. It's difficult to
methodically design something when you don't yet know what it is
you're designing.
2019-11-06 17:29:07 -05:00

14 lines
330 B
TypeScript

// Make the names explicit so that we don't get the order mixed up
interface Params {
maxCount: number;
nextIndex: number;
}
export function paginationCookie<T>(items: T[], params: Params) {
if (items.length < params.maxCount) {
return "-1";
} else {
return (params.nextIndex + params.maxCount).toString();
}
}