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

debounce-throttle-ts

v1.0.0

Published

A TypeScript package implementing debounce and throttle functions

Downloads

5

Readme

debounce-throttle-ts

A TypeScript package that implements debounce and throttle functions for optimizing performance in scenarios such as event handling, API calls, and more.

Features

  • Debounce: Ensures a function is executed only after a specified delay, useful for preventing excessive function calls (e.g., in search input or resize events).
  • Throttle: Ensures a function is executed at a fixed rate, useful for limiting the number of times a function can be called over time (e.g., scroll or mousemove events).

Installation

To install the package, run the following command:

npm install debounce-throttle-ts

Development Installation

If you're working on the development of the package, you can install the dependencies with:

npm install

Usage

Debounce Example

The debounce function creates a debounced version of the provided function. The debounced function will only execute after the specified delay has passed since the last invocation.

import { debounce } from 'debounce-throttle-ts';

// Example function to be debounced
const logMessage = (message: string) => {
  console.log(message);
};

// Create a debounced version of logMessage with a 1000ms delay
const debouncedLog = debounce(logMessage, 1000);

// Call debounced function multiple times
debouncedLog('Debounce 1');
debouncedLog('Debounce 2');
debouncedLog('Debounce 3');  // Only this one will be logged after 1 second

Throttle Example

The throttle function creates a throttled version of the provided function. The throttled function will only execute at most once every limit milliseconds.

import { throttle } from 'debounce-throttle-ts';

// Example function to be throttled
const logMessage = (message: string) => {
  console.log(message);
};

// Create a throttled version of logMessage with a 2000ms limit
const throttledLog = throttle(logMessage, 2000);

// Call throttled function multiple times
throttledLog('Throttle 1');
throttledLog('Throttle 2');
throttledLog('Throttle 3');  // Only the first and third logs will happen, 2 seconds apart

Development

  1. Build: Run the following command to compile the TypeScript files into JavaScript.

    npm run build
  2. Testing: You can add your tests in the src folder and run them using a testing framework like Jest or Mocha.

License

MIT License. See LICENSE for more information.

Author

Le Minh Hieu