@mimik/pagination-helper

2.0.1 • Public • Published

paginationHelper

Example

const { setUrlOnPaginatedResult } = require('@mimik/pagination-helper');

paginationHelper~setUrlOnPaginatedResult(data, options, basePath, serverSettings) ⇒ object

The response is an object of the following format

 {
   "data": "an array of items result of paginated search",
   "count": "a number. Present if different of 0",
   "nextPageUrl": "a URL to point to the next page. Present if the data lenght is less that the given pageSize"
 }

Kind: inner method of paginationHelper
Returns: object - The response to return to http request.
Category: sync
Requires: module:@mimik/address-helper

Param Type Description
data array data to include in the response.
options object = options to setup the response. Includes count, lastRecordId and pageSize.
basePath string = url base path in order to build the nextPageUrl. Can include queries.
serverSettings object = Server settings to build the nextPageUrl.`

paginationHelper~validatePaginationOptions(options) ⇒ boolean

Validating the pagination params.

Kind: inner method of paginationHelper
Returns: boolean - true.
Category: sync
Throws:

  • object An error (vError) with statusCode 400.

Requires: module:@mimik/response-helper

Param Type Description
options object = options to validate. IncludesstartAfter and pageSize.

Readme

Keywords

Package Sidebar

Install

npm i @mimik/pagination-helper

Weekly Downloads

2

Version

2.0.1

License

MIT

Unpacked Size

11.7 kB

Total Files

7

Last publish

Collaborators

  • sasan.raisdana
  • miburger
  • hofachiang
  • mimik-npm-editor
  • mimikopensource