skaleb-simple-paginator
Advanced tools
Comparing version 1.0.7 to 1.0.8
{ | ||
"name": "skaleb-simple-paginator", | ||
"version": "1.0.7", | ||
"description": "Simple client side pagination", | ||
"version": "1.0.8", | ||
"description": "Simple client for client-side pagination making use of generic types and allowing for chainable methods", | ||
"main": "dist/index.js", | ||
@@ -13,5 +13,14 @@ "types": "dist/index.d.ts", | ||
}, | ||
"files": [ | ||
"dist", | ||
"test", | ||
"LICENSE", | ||
".nycrc.json", | ||
".mocharc.js", | ||
"tslint.json", | ||
"tsconfig.json" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ToeFungi/skaleb-simple-paginator.git" | ||
"url": "https://github.com/ToeFungi/skaleb-simple-paginator.git" | ||
}, | ||
@@ -27,3 +36,7 @@ "keywords": [ | ||
], | ||
"author": "Alex Pickering", | ||
"author": { | ||
"email": "pickeringacw@gmail.com", | ||
"name": "Alex Pickering", | ||
"url": "https://github.com/ToeFungi/" | ||
}, | ||
"license": "MIT", | ||
@@ -35,13 +48,13 @@ "bugs": { | ||
"devDependencies": { | ||
"@types/chai": "4.1.7", | ||
"@types/mocha": "5.2.6", | ||
"@types/node": "11.9.5", | ||
"nyc": "14.1.1", | ||
"@types/chai": "4.2.7", | ||
"@types/mocha": "5.2.7", | ||
"@types/node": "13.1.8", | ||
"nyc": "15.0.0", | ||
"chai": "4.2.0", | ||
"mocha": "^6.2.2", | ||
"ts-node": "8.0.2", | ||
"tslint": "^5.20.0", | ||
"typescript": "3.3.3333", | ||
"tslint-config-standard": "^8.0.1" | ||
"mocha": "7.0.0", | ||
"ts-node": "8.6.2", | ||
"tslint": "6.0.0", | ||
"typescript": "3.7.5", | ||
"tslint-config-standard": "9.0.0" | ||
} | ||
} |
@@ -16,2 +16,18 @@ # Simple Paginator | ||
## Contents | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Importing](#importing) | ||
- [Instantiate instance](#instantiating) | ||
- [Setting array](#set-initial-dataset) | ||
- [Fetching page](#get-current-page) | ||
- [Next page](#increase-page-number) | ||
- [Previous page](#decrease-page-number) | ||
- [Setting page](#set-page-number) | ||
- [Setting page size](#set-page-size) | ||
- [Testing](#tests) | ||
- [Issues](#issues) | ||
- [Contributions](#contributions) | ||
- [License](#license) | ||
## Installation | ||
@@ -24,4 +40,5 @@ To install this package you can simply use the install command below. | ||
## Usage | ||
#### Importing | ||
Importing the package into your class. | ||
```javascript | ||
```typescript | ||
import { SimplePaginator } from 'skaleb-simple-paginator' | ||
@@ -35,4 +52,5 @@ | ||
#### Instantiating | ||
Instantiating a new instance of the paginator. | ||
```javascript | ||
```typescript | ||
const paginator = new SimplePaginator<string>() | ||
@@ -47,4 +65,5 @@ .setArray(arr) | ||
#### Set Initial Dataset | ||
`.setArray(x)` sets the array to be paginated. The returned items should retain their types. | ||
```javascript | ||
```typescript | ||
// The paginator will use the array defined above to paginate | ||
@@ -54,4 +73,5 @@ paginator.setArray(arr) | ||
#### Get Current Page | ||
`.getPage()` returns the number of items specified which are on the page specified. | ||
```javascript | ||
```typescript | ||
// Will return `PaginatorResponse` with five items being equal to | ||
@@ -62,4 +82,5 @@ // [ 'a', 'b', 'c', 'd', 'e' ] | ||
#### Increase Page Number | ||
`.incrementPage()` increases the page number within the paginator by one. | ||
```javascript | ||
```typescript | ||
// Will return `PaginatorResponse` with two items being equal to | ||
@@ -71,5 +92,6 @@ // [ 'f', 'g' ] | ||
#### Decrease Page Number | ||
`.decrementPage()` decreases the page number within the paginator by one. If the page number is less than one then the | ||
page number defaults to one. | ||
```javascript | ||
```typescript | ||
// Will return `PaginatorResponse` with five items being equal to | ||
@@ -81,5 +103,6 @@ // [ 'a', 'b', 'c', 'd', 'e' ] | ||
#### Set Page Number | ||
`.setPageNumber(x)` sets the page number within the paginator to the value specified. If the value specified is less | ||
than one then the page number defaults to one. | ||
```javascript | ||
```typescript | ||
// Will return `PaginatorResponse` with two items being equal to | ||
@@ -96,5 +119,6 @@ // [ 'f', 'g' ] | ||
#### Set Page Size | ||
`.setPageSize(x)` sets the number of items to be returned in the `PaginatorResponse` for any given page to the value | ||
specified. If the value specified is less than one then the page size defaults to one. | ||
```javascript | ||
```typescript | ||
// Will return `PaginatorResponse` with three items being equal to | ||
@@ -123,5 +147,16 @@ // [ 'a', 'b', 'c' ] | ||
## Issues | ||
If you find any problems while working with this library, please log an issue | ||
[here](https://github.com/ToeFungi/skaleb-simple-paginator/issues) so that development can begin to rectify the | ||
error. | ||
## Contributions | ||
Feedback and contributions are more than welcome. Should you feel there is something you wish to contribute to this | ||
paginator, feel free to make a merge request. Ensure that whatever proposed change, has tests covering various cases for | ||
the change. | ||
This project is completely open source and as such, you are invited to make contributions. Fork the project, make some | ||
changes and make the pull request. Should you have any feedback regarding the functionality, please don't hesitate to | ||
open an issue so this can be resolved. Please ensure that any pull requests have unit tests that cover any additional | ||
functionality. | ||
## License | ||
MIT License | ||
Copyright (c) 2019 Alex Pickering |
153
29195
25
527