@dadi/metadata

Generates pagination metadata for result sets in DADI products

Stats

StarsIssuesVersionUpdatedCreatedSize
@dadi/metadata
2.0.03 years ago5 years agoMinified + gzip package size for @dadi/metadata in KB

Readme

Metadata

Generates pagination metadata for result sets in DADI products.

npm (scoped)

{
  "page": 2,
  "limit": 20,
  "offset": 0,
  "totalCount": 200,
  "totalPages": 10,
  "nextPage": 3,
  "prevPage": 1  
}

Installation

$ npm install --save @dadi/metadata

Usage

The metadata function accepts two arguments:

argument description
options the options that were used to generate the data set
options.page the page number requested
options.limit the number of records requested
options.skip the number of records skipped
count the total number of records in the original data set, before options were applied
var meta = require('@dadi/metadata')

var options = {
  page: 2,
  limit: 20
}

var metadata = meta(options, 200)

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.