New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

debounce-micro

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

debounce-micro

wrap a function in a debounce microtask

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

debounce-micro

wrap a function in a debounce microtask

🔧 Install · 🧩 Example · 📜 API docs · 🔥 Releases · 💪🏼 Contribute · 🖐️ Help

Install

$ npm i debounce-micro

Example

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

Table of Contents

debounce

src/index.ts:8-33

Wraps a function in a debounce microtask.

Parameters

  • inner function (...args: Array<any>): any The function to wrap in the debounce

Returns any A debounced function

Contribute

Fork or edit and submit a PR.

All contributions are welcome!

License

MIT © 2021 stagas

Keywords

debounce

FAQs

Package last updated on 26 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts