clay-list-pager

3.0.1 • Public • Published

clay-list-pager

Build Status npm Version JS Standard

List pager for ClayDB

Installation

$ npm install clay-list-pager --save

Usage

'use strict'
 
const { paginateArray } = require('clay-list-pager')
 
{
  let array = [ { id: 1 }, { id: 2 }, { id: 3 } ]
  let page = { number: 2, size: 2 }
  let paginated = paginateArray(array, page)
 
  console.log(paginated) // -> [ { id: 3 } ]
}

Functions

Available functions

Signature Description
metaToPage() -> Object Convert clay collection meta object into page
pageToOffsetLimit(page, page.number, page.size) -> Object Convert page into offset/limit
paginateArray(array, page, page.number, page.size) -> Object[] Paginate array with paging condition

License

This software is released under the Apache-2.0 License.

Links

/clay-list-pager/

    Package Sidebar

    Install

    npm i clay-list-pager

    Weekly Downloads

    6

    Version

    3.0.1

    License

    Apache-2.0

    Unpacked Size

    36.4 kB

    Total Files

    34

    Last publish

    Collaborators

    • okunishinishi
    • realglobe