Socket
Socket
Sign inDemoInstall

pagination-calculator

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pagination-calculator

Utility to calculation pages for pagination


Version published
Weekly downloads
775
increased by31.8%
Maintainers
1
Weekly downloads
 
Created
Source

pagination-calculator

Installation

npm install pagination-calculator

Note: the package includes typings for Typescript

Usage

import { paginationCalculator } from "pagination-calculator";

const result = paginationCalculator(options);

Options

interface PageCalculatorOptions {
    total: number;                // total number of items
    current?: number;             // current page
    pageSize?: number;            // number of items per page
    pageLimit?: number;           // number of pages in array
}

Result

interface PageInformation {
    total: number;                // total number of items
    current: number;              // current page
    pageCount: number;            // total number of pages
    pages: (number | "...")[];    // array of page numbers
    next: number | false;         // next page or false if end
    previous: number | false;     // previous page or false if first
    showingStart: number;         // index of first item showing on current page
    showingEnd: number;           // index of last item showing on current page
}

Keywords

FAQs

Package last updated on 13 Mar 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc