simple-pagination
Simple pagination module for arrays.
Usage
1. Instalation
npm install arrpag --saveyarn add arrpagbower install arrpag --save
2. Return object
The return object
is an object of this format:
/** * @property currentPage - the current page - number * @property nextPage - the next page - number * @property prevPage - the previous page - number * @property perPage - number of elements per page * @property pages - total number of available pages * @property results - the paginated sub-array from the given array * @property totalCurrentResults - total number of current paginated items * @property totalResults - total number of results -> should be the initial array lengt */
3. Usage
Javascript
const paginator = ; // ... const arr = 1 2 3 4 5; const paginationResult = paginator;
Typescript
; // ... ; ;
AMD
;
For the previous example the output should be:
4. Test
npm run test