Skip to content
This repository has been archived by the owner on May 10, 2021. It is now read-only.

fiquu/pagination

Repository files navigation

@fiquu/pagination

Build Status GitHub GitHub last commit npm (scoped) npm

Simple, dependency-free pagination component.

Installation

npm i @fiquu/pagination

Usage

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);

Documentation

Please see the documentation page for more details.