# debounce-on

> debounce function calls based on arguments

Latest version **0.0.0** (published 2014-07-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install debounce-on
pnpm add debounce-on
yarn add debounce-on
bun add debounce-on
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.0 |
| Published | 2014-07-05 |
| First published | 2014-07-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Brian Ford |
| Maintainers | btford |
| Keywords | functional |

## Links

- npm: https://www.npmjs.com/package/debounce-on
- npm.io page: https://npm.io/package/debounce-on

## Recent versions

- 0.0.0 (latest) — 2014-07-05

## README

# debounce-on

debounce a function based on its arguments

## Install

```shell
$ npm install debounce-on
```


## Use

For instance, you might want to rate-limit a client on a per-endpoint basis:

```javascript
var debounceOn = require('debounce-on');

var debounceHttp = debounceOn(sendHttpRequest);
debounceHttp('https://google.com');
debounceHttp('https://google.com');
debounceHttp('https://yahoo.com');

// ... wait 100ms

// one request is sent to:
// - google.com
// - yahoo.com
```

You can pass a hash function that determines what calls the debouncer should coalesce:

```javascript
var debounceOn = require('debounce-on');

var debounceHttp = debounceOn(sendHttpRequest, function (url) {
  return (url.match(/^https?:\/\/([^\/])\/?/) || {})[1];
});
debounceHttp('https://google.com/a');
debounceHttp('https://google.com/b');
debounceHttp('https://yahoo.com');

// ... wait 100ms

// one request is sent to:
// - google.com/a
// - yahoo.com
```


## API

```javascript
ver debouncedFn = debounceOn(fn, [timeout], [hash fn]);
```

### `fn`
The function to debounce.

### `timeout`
The timeout in `ms`.

### `hashFn`
Function that determines what calls the debouncer should coalesce.


## License
MIT

---
_Source: https://npm.io/package/debounce-on · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
