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

sequelize-paginate-helper

v1.0.1

Published

A Sequelize pagination helper...

Readme

Step 1: Prepare Your Package

  1. Create a dedicated directory: If you haven't already, ensure this code is in its own directory (e.g., sequelize-paginate-helper).

  2. Initialize npm: Navigate to this directory in your terminal and run:

    npm init

    Follow the prompts. For the package name, you might want something like sequelize-paginate-helper. Keep the entry point as the file containing your paginate function (e.g., index.js).

  3. Create index.js: If you haven't already, save the code you provided in a file named index.js (or whatever you specified as the entry point during npm init).

  4. Add a package.json: The npm init command will create this file. Review it to ensure the information is correct. You might want to add keywords like sequelize, pagination, helper.

  5. Add a LICENSE file: Create a LICENSE file in your project root. A common choice is the MIT license. You can find the text online.

  6. Create a README.md: This file will explain how to use your package on npm. Include:

    • Your package name (sequelize-paginate-helper).
    • A short description.
    • Installation instructions (npm install sequelize-paginate-helper).
    • Usage examples showing how to import and use the paginate function with a Sequelize model.
    • API documentation explaining the parameters and the return value of the paginate function.
    • License information.

    Here's a basic example for your README.md:

    # sequelize-paginate-helper
    
    A Sequelize pagination helper with advanced filtering and ordering.
    
    ## Installation
    
    ```bash
    npm install sequelize-paginate-helper

    Usage

    const { Sequelize, DataTypes, Op } = require('sequelize');
    const paginate = require('sequelize-paginate-helper');
    
    const sequelize = new Sequelize('sqlite::memory:');
    
    const User = sequelize.define('User', {
      name: DataTypes.STRING,
      email: DataTypes.STRING,
    });
    
    async function main() {
      await sequelize.sync();
      await User.bulkCreate([
        { name: 'Alice', email: '[email protected]' },
        { name: 'Bob', email: '[email protected]' },
        { name: 'Charlie', email: '[email protected]' },
      ]);
    
      const results = await paginate(
        User,
        1, // pageSize
        10, // pageLimit
        'name', // order_by
        'ASC', // order_direction
        ['id', 'name'], // attributes
        {}, // where
        [ // filters
          { filterKey: 'name', operation: 'like', value: 'A' },
        ],
        [], // includes
        'id' // distinctColumn
      );
    
      console.log(results);
    }
    
    main();

    API

    paginate(model, pageSize, pageLimit, order_by, order_direction, attributes, where, filters, includes, distinctColumn)

    Asynchronously paginates a Sequelize model query with filtering and ordering.

    Parameters:

    • model: The Sequelize model.
    • pageSize: The current page number (integer).
    • pageLimit: The number of records per page (integer).
    • order_by: The field to order by (string, default: 'id'). Can also be an object for included models.
    • order_direction: The order direction ('ASC' or 'DESC').
    • attributes (optional): An array of attributes to select.
    • where (optional): A Sequelize where clause object.
    • filters (optional): An array of filter objects with filterKey, operation (Sequelize Op), and value.
    • includes (optional): An array of Sequelize include options.
    • distinctColumn (optional): The column to use for DISTINCT.

    Returns:

    An object containing pagination metadata and the data.

    License

    MIT

    Author

    [Vivek Gupta] ([[email protected]/IC Rudra])

        

Step 2: Publish to npm

  1. Sign up for npm: If you don't have an account, go to https://www.npmjs.com/signup and create one.

  2. Log in to npm in your terminal:

    npm login

    Enter your npm username, password, and email.

  3. Publish your package:

    npm publish

    Make sure you are in the root directory of your package (the one containing package.json).

  4. Verify: After successful publishing, you should be able to find your package on the npm website: https://www.npmjs.com/package/sequelize-paginate-helper (or whatever name you chose).

That's it! You've published your Sequelize pagination helper. Let me know if you encounter any issues or have further questions. It's Sunday afternoon here in Noida. What are your plans for the rest of the day?