npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pagino

v1.4.3

Published

This project aims to handle pagination core object in Javascript independent of UI

Downloads

467

Readme

Pagino

Pagino is a lightweight JavaScript library designed to handle pagination logic independently of any UI framework. It generates pagination arrays with intelligent page number grouping, supporting navigation buttons, ellipsis indicators, and customizable boundaries and sibling counts.

Installation

npm i pagino

Basic Usage

import Pagino from 'pagino';

const pagino = new Pagino();
pagino.setCount(10);
pagino.setPage(1);
pagino.getPages();
/**
 * ['first', 'previous', 1, 2, 3, 4, 5, 'end-ellipsis', 10, 'next', 'last']
 */

pagino.setPage(5);
pagino.getPages();
/**
 * ['first', 'previous', 1, 'start-ellipsis', 4, 5, 6, 'end-ellipsis', 10, 'next', 'last']
 */

Method Chaining

All setter methods support chaining for convenient configuration:

pagino
  .setCount(10)
  .setPage(1)
  .getPages();

Configuration Options

Initialize Pagino with custom options:

const pagino = new Pagino({
  showFirst: true,        // Show 'first' button
  showPrevious: true,     // Show 'previous' button
  showNext: true,         // Show 'next' button
  showLast: true,         // Show 'last' button
  page: 1,                // Current page (default: 1)
  count: undefined,       // Total number of pages
  siblingCount: 1,        // Number of pages around current page
  boundaryCount: 1,       // Number of pages at start and end
});

API Methods

setCount(count: number): Pagino

Sets the total number of pages and triggers onChange callback.

setPage(page: number): Pagino

Sets the current page. Invalid page numbers (≤ 0 or > count) are ignored. Triggers onChange callback.

getPages(): Array<number | string>

Returns an array representing the pagination structure with:

  • 'first' - Jump to first page
  • 'previous' - Go to previous page
  • 'next' - Go to next page
  • 'last' - Jump to last page
  • 'start-ellipsis' - Indicates skipped pages at the start
  • 'end-ellipsis' - Indicates skipped pages at the end
  • Numbers - Page numbers

first(): Pagino

Jump to the first page.

pagino.first();

last(): Pagino

Jump to the last page.

pagino.last();

next(): Pagino

Move to the next page (if available).

pagino.next();

previous(): Pagino

Move to the previous page (if available).

pagino.previous();

Event Handling

Listen to page and count changes using the onChange callback:

const pagino = new Pagino({
  onChange: (page, count) => {
    console.log(`Page: ${page}, Total Pages: ${count}`);
  }
});

pagino.setCount(30);  // Triggers onChange
pagino.setPage(5);    // Triggers onChange
pagino.next();        // Triggers onChange

Usage with Deno

import Pagino from 'https://raw.githubusercontent.com/pagino/pagino-js/main/src/index.ts';

Features

  • Framework Agnostic: No dependencies on any UI framework
  • Smart Pagination: Automatically generates optimized pagination arrays
  • Customizable: Configure boundaries, sibling counts, and visible buttons
  • Event Driven: Subscribe to page and count changes
  • Chainable API: Fluent interface for convenient method chaining
  • Lightweight: Minimal bundle size with no external dependencies
  • Type Safe: Full TypeScript support