2.0.1 • Published 7 months ago

@mimik/pagination-helper v2.0.1

Weekly downloads
-
License
MIT
Repository
bitbucket
Last release
7 months ago

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

ParamTypeDescription
dataarraydata to include in the response.
optionsobject= options to setup the response. Includes count, lastRecordId and pageSize.
basePathstring= url base path in order to build the nextPageUrl. Can include queries.
serverSettingsobject= 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

ParamTypeDescription
optionsobject= options to validate. IncludesstartAfter and pageSize.
2.0.1

7 months ago

2.0.0

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

2 years ago

1.0.0

2 years ago