Simple, dependency-free pagination component.
npm i @fiquu/pagination
import { createPagination, PaginationComponent } from '@fiquu/pagination';
const pagination: PaginationComponent = createPagination({ limit: 50 });
const { limit, skip } = pagination.paginate(3); // limit = 50; skip = 100;
// Or in some query...
const query = await Posts.find()
.skip(pagination.skip(req.query.page))
.limit(pagination.limit);
Please see the documentation page for more details.
Pagination Component factory.
The component instance.
Calculates pagination parameters.
The limit to use.
The page number to paginate.
The calculated pagination parameters.
Calculates the skip
value according to the provided page number.
The limit to use.
The page to calculate the skip value for.
The skip count.
Generated using TypeDoc
The limit per page.