# proxy-debounce-with-accumulator

> Simple function creating a debounced function with Proxy

Latest version **0.0.4** (published 2019-11-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install proxy-debounce-with-accumulator
pnpm add proxy-debounce-with-accumulator
yarn add proxy-debounce-with-accumulator
bun add proxy-debounce-with-accumulator
```

## 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.4 |
| Published | 2019-11-17 |
| First published | 2019-11-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 12.13 <13 |
| Dependencies | 1 |
| Unpacked size | 4.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Łukasz Karczewski |
| Maintainers | lukigarazus |
| Keywords | proxy, Proxy, ES6, debounce, accumulator |

## Links

- npm: https://www.npmjs.com/package/proxy-debounce-with-accumulator
- Homepage: https://github.com/lukigarazus/proxy-debounce-with-accumulator
- npm.io page: https://npm.io/package/proxy-debounce-with-accumulator

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ~1.10.0

## Recent versions

- 0.0.4 (latest) — 2019-11-17
- 0.0.3 — 2019-11-17
- 0.0.2 — 2019-11-17
- 0.0.1 — 2019-11-17

## README

![coverage lines](coverage/badge-lines.svg 'Coverage lines') ![coverage functions](coverage/badge-functions.svg 'Coverage functions') ![coverage branches](coverage/badge-branches.svg 'Coverage branches') ![coverage statements](coverage/badge-statements.svg 'Coverage statements')

# Proxy debounce with accumulator

This is a simple package implementing **debounce** with JS Proxy.

However, there is a big twist:

```javascript
import debounce from "proxy-debounce-with-accumulator"

const f = debounce((n) => n), 100)

for (let i = 0; i < 10; i++) {
    f(i)
}
```

such a code would call the **f** function once, as expected of a debounced function, but during this call the value of **n** would equal **[0,1,2,3,4,5,6,7,8,9]**, since the call arguments are **accumulated**.

You can also **await** such a function:

```javascript
import debounce from "proxy-debounce-with-accumulator"

const f = debounce((n) => n), 100)

for (let i = 0; i < 10; i++) {
    if (i === 4) {
        await f(i)
    }
    else {
        f(i)
    }
}
```

In such a code the arguments passed to the function would be: **[0,1,2,3,4]** and **[5,6,7,8,9]**.

### Performance

Run tests in order to see detailed performance differences between this package, lodash and regular objects.

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