Skip to content

Commit

Permalink
version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
stagas committed Dec 21, 2021
1 parent 47ad0ae commit 7f5707f
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 11 deletions.
70 changes: 69 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,69 @@
# debounce-micro
<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-24](https://github.com/stagas/debounce-micro/blob/47ad0aec0ffc4b0f13650d5a26dc02ee52e46efb/src/index.ts#L8-L24 "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)
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "stagas",
"short": "stagas/debounce-micro",
"description": "wrap a function in a debounce microtask",
"version": "0.0.0",
"version": "1.0.0",
"license": "MIT",
"private": true,
"repository": {
Expand Down Expand Up @@ -57,25 +57,25 @@
"devDependencies": {
"@stagas/documentation-fork": "^13.2.5",
"@stagas/sucrase-jest-plugin": "^2.2.0-fork",
"@swc-node/jest": "^1.4.1",
"@swc-node/jest": "^1.4.3",
"@tsconfig/node16": "^1.0.2",
"@types/jest": "^27.0.3",
"@types/node": "^16.11.12",
"@typescript-eslint/eslint-plugin": "^5.6.0",
"@typescript-eslint/parser": "^5.6.0",
"esbuild": "^0.14.3",
"@types/node": "^17.0.2",
"@typescript-eslint/eslint-plugin": "^5.8.0",
"@typescript-eslint/parser": "^5.8.0",
"esbuild": "^0.14.6",
"esbuild-register": "^3.2.1",
"eslint": "^8.4.1",
"eslint": "^8.5.0",
"eslint-plugin-import": "^2.25.3",
"fpick": "^1.1.0",
"husky": "^7.0.4",
"jest": "^27.4.4",
"jest": "^27.4.5",
"onchange": "^7.1.0",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"terser": "^5.10.0",
"ts-jest": "^27.1.1",
"ts-jest": "^27.1.2",
"ts-node": "^10.4.0",
"typescript": "^4.5.3"
"typescript": "^4.5.4"
}
}

0 comments on commit 7f5707f

Please sign in to comment.