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

niddar-pagination-generator

v1.5.8

Published

This repository contains a npm module with a very practical approach to generator pagination.

Readme

Niddar: Pagination Generator

Practical Pagination Generator For NodeJS

GitHub issues GitHub license

Tried almost almost every package available on npm to generate pagination but none of them solve the purpose without customizing the code.

This repository contains a npm module with a very practical approach to generate pagination.

Install

npm install --save niddar-pagination-generator

Usage

var pagination = require('niddar-pagination-generator');
var config = {
    totalRecords: 10,
    recordsPerPage: 5,
    currentPage: 1
};
var paginator = new NiddarPagination(config);

Output

Pagination {
config: 
   { totalRecords: 11,
     recordsPerPage: 5,
     currentPage: 1,
     currentUrl: '',
     template: 'bootstrap',
     pageParameter: 'page',
     first: 1,
     displayPages: 10,
     firstLabel: '«',
     previousLabel: '‹',
     nextLabel: '›',
     lastLabel: '»' 
   },
offset: 5,
totalPages: 3,
range: 
   [ { page: 1, url: '?page=1', isCurrent: true },
     { page: 2, url: '?page=2' },
     { page: 3, url: '?page=2' },
     { page: 2, url: '?page=2', label: '›'  },
     { page: 3, url: '?page=3', label: '»' } 
   ],
render:'<nav aria-label="Page navigation"><ul class="pagination"><li class="active"><a href="?page=1">1</a></li><li class=""><a href="?page=2">2</a></li><li class=""><a href="?page=3">3</a></li><li class=""><a href="?page=2">›</a></li><li class=""><a href="?page=3">»</a></li></ul></nav>'
}

Custom URL

In a real world, you would like to generate pagination url with other parameters as well.

Example: Current url: example.com/users?filter=name or example.com/users?filterA=valA&filterB=valB

In such scenario you can configure pagination like following:

var pagination = require('niddar-pagination-generator');

var config = {
    totalRecords: 10,
    recordsPerPage: 5,
    currentPage: 1,
    currentUrl: url //value of current url 
};
var paginator = new NiddarPagination(config);

This will generate url with adding another parameter in url as page. Output url will be following:

Input url = example.com/users?filter=name
Output url = example.com/users?filter=name&page=1

Available Configurations

 var config = {
       totalRecords    :   10, //total number of records
       recordsPerPage  :   5, //items per item
       currentPage     :   1, //current page
       currentUrl      :   "http://example.com", //value of current url 
       template        :   'bootstrap', //it support "bootstrap" & "foundation"
       pageParameter   :   'page', //page parameter name
       displayPages    :   10, //number of pages to display
       firstLabel      :   '«', 
       previousLabel   :   '‹', 
       nextLabel       :   '›',
       lastLabel       :   '»'  
 };