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

function-performer

v1.0.1

Published

Performer providing API for debounce, throttle and deduplication functions

Readme

function-performer

Latest Release Total Downloads Install Size License

Performer providing API for debounce, throttle and deduplication functions.

Installation

npm install function-performer

# or
pnpm install function-performer

# or
yarn add function-performer

API

constructor

Type: new (config?: PerformerConfig): Performer

Options

  • config — Optional parameter providing the performer configuration.
    • debounce - An optional property that provides a debounce configuration.
      • interval - The time in milliseconds during which the target function execution will be discarded. (default value is 0)
    • throttle - An optional property that provides a throttle configuration.
      • interval - The time in milliseconds during which the target function execution will be blocked. (default value is 0)
    • deduplication - An optional property that provides a deduplication configuration.
      • interval - The time in milliseconds during which duplicate detection will occur after calling the target function. (default value is 0)

Example

import { Performer } from 'function-performer';

const performer = new Performer({
  debounce: { interval: 500 },
  throttle: { interval: 1000 },
  deduplication: { interval: 100 },
});

debounce

Type: (func: DebouncedFunction, ...args: unknown[]) => void

Discards execution of operations performed within the specified interval.

Parameters

  • func — A function whose call will be discarded.
  • ...args — A set of parameters for the function being performed.

Example

import { Performer } from 'function-performer';

const performer = new Performer({
  debounce: { interval: 1000 },
});

const func = (arg: number) => {
  console.log(arg);
};

performer.debounce(func, 1); // will be discarded
performer.debounce(func, 2); // will be discarded
performer.debounce(func, 3); // logs `3`

setTimeout(() => {
  performer.debounce(func, 4); // logs `4`
}, 2000);

throttle

Type: (func: ThrottledFunction, ...args: unknown[]) => void

Blocks execution of operations performed within the specified interval.

Parameters

  • func — A function whose call will be blocked.
  • ...args — A set of parameters for the function being performed.

Example

import { Performer } from 'function-performer';

const performer = new Performer({
  // Will only allow one call every 100 milliseconds
  throttle: { interval: 100 },
});

const func = (arg: number) => {
  console.log(arg);
};

let time = 0;
const interval = setInterval(() => {
  if(time === 1000) {
    clearInterval(interval);
    return;
  }

  performer.throttle(func, time); // logs `0`, `100`, `200`, `300`, …, `900`

  time += 10;

  // Will be called every 10 milliseconds
}, 10);

deduplicate

Type: (func: DeduplicatedFunction, ...args: unknown[]) => void

Detects duplicate function calls and executes the function only once during the specified interval.

Parameters

  • func — A function whose duplicate executions will be detected. The first parameter of the function should be the number of detected calls.
  • ...args — A set of parameters for the function being performed.

Example

import { Performer } from 'function-performer';

const performer = new Performer({
  deduplication: { interval: 100 },
});

const func1 = (count: number, arg: number) => {
  console.log({ count, arg });
};

const func2 = (count: number, arg: object) => {
  console.log({ count, arg });
};

performer.deduplicate(func1, 1); // will be blocked
performer.deduplicate(func1, 1); // logs `{ count: 2, arg: 1 }`
performer.deduplicate(func2, { foo: { bar: 'baz' } }); // will be blocked
performer.deduplicate(func2, { foo: { bar: 'baz' } }); // will be blocked
performer.deduplicate(func2, { foo: { bar: 'baz' } }); // logs `{ count: 3, arg: { foo: { bar: 'baz' } } }`

setTimeout(() => {
  performer.deduplicate(func2, { foo: { bar: 'baz' } }); // logs `{ count: 1, arg: { foo: { bar: 'baz' } } }`
}, 1000);