paginate-array-ts

Pagination for arrays in javascript

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
paginate-array-ts
1,803301.0.05 years ago5 years agoMinified + gzip package size for paginate-array-ts in KB

Readme

Array pagination
Simple pagination for arrays in javascript

Installation

npm install paginate-array-ts

Usage

import { paginateArray } from 'paginate-array-ts';
const collection = [...];

const paginateCollection = paginate<T>(collection[,pageNumber, numItemsPerPage]);

The result of paginateCollection will be an object:

{
    currentPage: 1,
    perPage: 10,
    total: 20,
    totalPages: 2,
    data: [...]
}