clay-list-pager
List pager for ClayDB
Installation
$ npm install clay-list-pager --save
Usage
'use strict' const paginateArray = let array = id: 1 id: 2 id: 3 let page = number: 2 size: 2 let paginated = console // -> [ { 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.