🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

pagination-object-generator

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pagination-object-generator

Generate pagination object.

1.0.0
latest
Source
npm
Version published
Weekly downloads
270
73.08%
Maintainers
1
Weekly downloads
 
Created
Source

pagination-object-generator

CircleCI

Generate pagination object.

It does not depend on the library.

##DEMO

##Usage npm install pagination-object-generator

import pagination from "pagination-object-generator";

const offset = 0;
const limit = 20;
const totalCount = 1000;
const showCount = 4;

const results = pagination(offset, limit, totalCount, showCount);
results = pages:[
  {
    "offset": 0,
    "current": true,
    "firstNum": 1,
    "secondNum": 20,
    "pageNum": 1
  },
  {
    "offset": 20,
    "current": false,
    "firstNum": 21,
    "secondNum": 40,
    "pageNum": 2
  },
  {
    "offset": 40,
    "current": false,
    "firstNum": 41,
    "secondNum": 60,
    "pageNum": 3
  },
  {
    "offset": 60,
    "current": false,
    "firstNum": 61,
    "secondNum": 80,
    "pageNum": 4
  }
],
last:{
  "index": 50,
  "offset": 1000
},
paging:{
  "prev": false,
  "next": 20
}

Keywords

pagination

FAQs

Package last updated on 28 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts