New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

use-debouncy

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-debouncy - npm Package Compare versions

Comparing version 4.6.0 to 5.0.0

CHANGELOG.md

2

lib/index.es.js

@@ -1,2 +0,2 @@

import{useRef as e,useCallback as n,useEffect as t}from"react";const a=(a,o=0)=>{const r=e(0),c=n(((...e)=>{cancelAnimationFrame(r.current);const n=performance.now(),t=c=>{c-n<o?r.current=requestAnimationFrame(t):a(...e)};r.current=requestAnimationFrame(t)}),[a,o]);return t((()=>()=>cancelAnimationFrame(r.current)),[]),c},o=[],r=(n,r=0,c=o)=>{const m=e(!0),s=a(n,r);t((()=>{m.current?m.current=!1:s()}),c)};export{r as useDebouncyEffect,a as useDebouncyFn};
import{useRef as n,useCallback as e,useEffect as r}from"react";const t=(t,a=0)=>{const o=n(0),c=e(((...n)=>{cancelAnimationFrame(o.current);const e=performance.now(),r=c=>{c-e<a?o.current=requestAnimationFrame(r):t(...n)};o.current=requestAnimationFrame(r)}),[t,a]);return r((()=>()=>cancelAnimationFrame(o.current)),[]),c},a=[],o=(e,o=0,c=a)=>{const m=n(!0),i=t(e,o);r((()=>{m.current?m.current=!1:i()}),c)};export{o as useDebouncyEffect,t as useDebouncyFn};
//# sourceMappingURL=index.es.js.map

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"t",{value:!0});var e=require("react");const r=(r,t=0)=>{const n=e.useRef(0),a=e.useCallback(((...e)=>{cancelAnimationFrame(n.current);const a=performance.now(),o=c=>{c-a<t?n.current=requestAnimationFrame(o):r(...e)};n.current=requestAnimationFrame(o)}),[r,t]);return e.useEffect((()=>()=>cancelAnimationFrame(n.current)),[]),a},t=[];exports.useDebouncyEffect=(n,a=0,o=t)=>{const c=e.useRef(!0),s=r(n,a);e.useEffect((()=>{c.current?c.current=!1:s()}),o)},exports.useDebouncyFn=r;
"use strict";var e=require("react");const r=(r,n=0)=>{const t=e.useRef(0),a=e.useCallback(((...e)=>{cancelAnimationFrame(t.current);const a=performance.now(),c=o=>{o-a<n?t.current=requestAnimationFrame(c):r(...e)};t.current=requestAnimationFrame(c)}),[r,n]);return e.useEffect((()=>()=>cancelAnimationFrame(t.current)),[]),a},n=[];exports.useDebouncyEffect=(t,a=0,c=n)=>{const o=e.useRef(!0),i=r(t,a);e.useEffect((()=>{o.current?o.current=!1:i()}),c)},exports.useDebouncyFn=r;
//# sourceMappingURL=index.js.map
{
"name": "use-debouncy",
"version": "4.6.0",
"version": "5.0.0",
"author": "Egor Avakumov",

@@ -28,7 +28,7 @@ "description": "🌀 Small (~0.2kb) debounce effect hook for React with TypeScript support",

"lint": "eslint . --ext .js,.ts",
"build": "rollup -c",
"build": "rollup -c --bundleConfigAsCjs",
"clear": "rimraf lib",
"prebuild": "yarn clear && tsc -p tsconfig.declaration.json",
"release": "release-it",
"prepare": "husky install"
"release": "semantic-release",
"prepare": "node -e \"try { require('husky').install() } catch (e) {if (e.code !== 'MODULE_NOT_FOUND') throw e}\""
},

@@ -41,6 +41,12 @@ "peerDependencies": {

"@commitlint/config-conventional": "17.7.0",
"@playwright/test": "1.37.1",
"@release-it/conventional-changelog": "7.0.0",
"@rollup/plugin-commonjs": "24.0.1",
"@playwright/test": "1.38.0",
"@rollup/plugin-commonjs": "25.0.4",
"@rollup/plugin-sucrase": "5.0.1",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/commit-analyzer": "11.0.0",
"@semantic-release/exec": "6.0.3",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "9.0.6",
"@semantic-release/npm": "11.0.0",
"@semantic-release/release-notes-generator": "12.0.0",
"@testing-library/react": "14.0.0",

@@ -53,3 +59,2 @@ "@types/jest": "29.5.4",

"@vitejs/plugin-react": "4.0.4",
"conventional-changelog-angular": "6.0.0",
"eslint": "8.48.0",

@@ -59,3 +64,3 @@ "eslint-config-prettier": "8.6.0",

"eslint-plugin-import": "2.27.5",
"eslint-plugin-n": "16.0.1",
"eslint-plugin-n": "16.0.2",
"eslint-plugin-prettier": "4.2.1",

@@ -67,12 +72,13 @@ "eslint-plugin-promise": "6.1.1",

"husky": "8.0.3",
"jest": "29.6.3",
"jest-environment-jsdom": "29.6.3",
"prettier": "2.8.4",
"jest": "29.6.4",
"jest-environment-jsdom": "29.6.4",
"prettier": "2.8.8",
"pretty-quick": "3.1.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"release-it": "16.1.5",
"rimraf": "5.0.1",
"rollup": "2.79.1",
"rollup": "3.29.2",
"rollup-plugin-terser": "7.0.2",
"semantic-release": "22.0.0",
"semantic-release-yarn": "2.0.1",
"ts-jest": "29.1.1",

@@ -91,27 +97,36 @@ "ts-node": "10.9.1",

},
"packageManager": "yarn@3.6.2",
"release-it": {
"git": {
"commitMessage": "chore(release): v${version}",
"push": true,
"commit": true,
"tag": true,
"requireCommits": false,
"requireCleanWorkingDir": false
},
"github": {
"release": true,
"draft": true
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": "angular",
"infile": "CHANGELOG.md",
"header": "# Changelog"
}
},
"hooks": {
"after:release": "echo Successfully released ${name} v${version} to ${repo.repository}."
}
"packageManager": "yarn@3.6.3",
"release": {
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"semantic-release-yarn",
{
"tarballDir": "lib"
}
],
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md",
"package.json"
]
}
],
[
"@semantic-release/github",
{
"assets": [
"lib/**"
]
}
]
]
}
}
}

@@ -44,3 +44,3 @@ # useDebouncy

import React, { useState } from 'react';
import useDebouncy from 'use-debouncy/effect'; // <== importing from effect
import { useDebouncyEffect } from 'use-debouncy';

@@ -50,3 +50,3 @@ const App = () => {

useDebouncy(
useDebouncyEffect(
() => fetchData(value), // function debounce

@@ -57,5 +57,3 @@ 400, // number of milliseconds to delay

return (
<input value={value} onChange={(event) => setValue(event.target.value)} />
);
return <input value={value} onChange={(event) => setValue(event.target.value)} />;
};

@@ -68,6 +66,6 @@ ```

import React, { useState } from 'react';
import useDebouncy from 'use-debouncy/fn'; // <== importing from fn
import { useDebouncyFn } from 'use-debouncy';
const App = () => {
const handleChange = useDebouncy(
const handleChange = useDebouncyFn(
(event) => fetchData(event.target.value), // function debounce

@@ -98,6 +96,3 @@ 400, // number of milliseconds to delay

```typescript
function useDebouncyFn(
fn: (...args: any[]) => void,
wait?: number,
): (...args: any[]) => void;
function useDebouncyFn(fn: (...args: any[]) => void, wait?: number): (...args: any[]) => void;
```

@@ -104,0 +99,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc