mirror of
https://github.com/immich-app/immich.git
synced 2025-11-29 17:55:18 -05:00
17 lines
369 B
TypeScript
17 lines
369 B
TypeScript
export interface PaginationOptions {
|
|
take: number;
|
|
skip?: number;
|
|
}
|
|
|
|
export interface PaginationResult<T> {
|
|
items: T[];
|
|
hasNextPage: boolean;
|
|
}
|
|
|
|
export function paginationHelper<Entity extends object>(items: Entity[], take: number): PaginationResult<Entity> {
|
|
const hasNextPage = items.length > take;
|
|
items.splice(take);
|
|
|
|
return { items, hasNextPage };
|
|
}
|