# debounce-micro

> wrap a function in a debounce microtask

Latest version **2.0.0** (published 2022-01-26) · MIT license · 1 weekly downloads

## Install

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

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score; declining downloads.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2022-01-26 |
| First published | 2021-12-21 |
| Weekly downloads | 1 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | stagas |
| Maintainers | stagas |
| Keywords | debounce, microtask |

## Links

- npm: https://www.npmjs.com/package/debounce-micro
- Repository: https://git@github.com/stagas/debounce-micro
- Homepage: https://github.com/stagas/debounce-micro#readme
- Issues: https://github.com/stagas/debounce-micro/issues
- npm.io page: https://npm.io/package/debounce-micro

## Recent versions

- 2.0.0 (latest) — 2022-01-26
- 1.0.0 — 2021-12-21

## README

<h1 align="center">debounce-micro</h1>

<p align="center">
wrap a function in a debounce microtask
</p>

<p align="center">
   <a href="#install">        🔧 <strong>Install</strong></a>
 · <a href="#example">        🧩 <strong>Example</strong></a>
 · <a href="#api">            📜 <strong>API docs</strong></a>
 · <a href="https://github.com/stagas/debounce-micro/releases"> 🔥 <strong>Releases</strong></a>
 · <a href="#contribute">     💪🏼 <strong>Contribute</strong></a>
 · <a href="https://github.com/stagas/debounce-micro/issues">   🖐️ <strong>Help</strong></a>
</p>

***

## Install

```sh
$ npm i debounce-micro
```

## Example

```ts
let x = 0
const fn = debounce((y: number) => (x += y))
fn(1)
fn(2)
expect(x).toEqual(0)
queueMicrotask(() => {
  expect(x).toEqual(2) // instead of 3
  done()
})
```

## API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

#### Table of Contents

*   [debounce](#debounce)
    *   [Parameters](#parameters)

### debounce

[src/index.ts:8-33](https://github.com/stagas/debounce-micro/blob/a643a0e748435a0c5b8e7dc183d3303dcebf5d8a/src/index.ts#L8-L33 "Source code on GitHub")

Wraps a function in a debounce microtask.

#### Parameters

*   `inner` **function (...args: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<any>): any** The function to wrap in the debounce

Returns **any** A debounced function

## Contribute

[Fork](https://github.com/stagas/debounce-micro/fork) or
[edit](https://github.dev/stagas/debounce-micro) and submit a PR.

All contributions are welcome!

## License

MIT © 2021
[stagas](https://github.com/stagas)

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