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 🙏

© 2024 – Pkg Stats / Ryan Hefner

just-my-pagination

v1.0.1

Published

A simple pagination module that returns HTML pagination links for your front-end projects.

Downloads

6

Readme

Just My Pagination

A simple pagination module that returns HTML pagination links for your front-end projects.
Pagination links are returned as /pageUri/pageNumber/.
By default Just My Paginatuon supports Google Material Icons for navigation arrows. If you want to use them don't forget to include in your pages the relative icon font and CSS.

Installation

$ npm install just-my-pagination

Example

This server side code:

var options = {
   pName: 'example', /*Page path*/
   total: 500, /*Total number of results*/
   page: 1, /*Actual page number*/
   query: req.query, /* Query String*/
   limit: 20, /* Results per page*/
}

pagination = require('just-my-pagination').getPagination(options);

Returns client side:

<div id="pagination">
   <span>
      <a href="/example/1/?order=date&sort=desc"><i class="material-icons">first_page</i></a>
   </span>
   <span>
      <a href="/example/3/?order=date&sort=desc"><i class="material-icons">chevron_left</i></a>
   </span>
   <a href="/example/1/?order=date&sort=desc">1</a>
   <a href="/example/2/?order=date&sort=desc">2</a>
   <a href="/example/3/?order=date&sort=desc">3</a>
   <strong>4</strong>
   <a href="/example/5/?order=date&sort=desc">5</a>
   <a href="/example/6/?order=date&sort=desc">6</a>
   <a href="/example/7/?order=date&sort=desc">7</a>
   <span>
      <a href="/example/5/?order=date&sort=desc"><i class="material-icons">chevron_right</i></a>
   </span>
   <span>
      <a href="/example/25/?order=date&sort=desc"><i class="material-icons">last_page</i></a>
   </span>
</div>

Options

| Prop | Description | Default | |---|---|---| | pName | Absolute path of the page where you want to use JMP. | None | | total | Total number of results showed per page (required to calculate how many page there is). | None | | limit | How many results you show per page (required to calculate how many page there is). | None | | page | Actual page number. As you can see in above example it's wrapped in a strong tag. | None | | query | URL query string to pass throug pages. | None | | pagID | (Optional) HTML ID property name of pagination block. | pagination | | firstPage | (Optional) HTML of first page link. | <i class="material-icons">first_page</i> | | prevPage | (Optional) HTML of previous page link. | <i class="material-icons">chevron_left</i> | | nextPage | (Optional) HTML of next page link. | <i class="material-icons">chevron_left</i> | | lastPage | (Optional) HTML of last page link. | <i class="material-icons">last_page</i> | | range | (Optional) Number of links before and after actual page number. | 3 |