Gathering detailed insights and metrics for use-lodash-debounce
Gathering detailed insights and metrics for use-lodash-debounce
npm install use-lodash-debounce
Typescript
Module System
Min. Node Version
Node Version
NPM Version
72.8
Supply Chain
92.2
Quality
75
Maintenance
100
Vulnerability
99.6
License
TypeScript (77.41%)
JavaScript (22.59%)
Total Downloads
1,000,574
Last Day
165
Last Week
990
Last Month
9,314
Last Year
131,951
55 Stars
42 Commits
6 Forks
1 Watching
6 Branches
4 Contributors
Minified
Minified + Gzipped
Latest Version
1.3.0
Package Id
use-lodash-debounce@1.3.0
Unpacked Size
11.13 kB
Size
3.63 kB
File Count
8
NPM Version
6.14.11
Node Version
14.16.0
Cumulative downloads
Total Downloads
Last day
3.1%
165
Compared to previous day
Last week
-50%
990
Compared to previous week
Last month
-13.6%
9,314
Compared to previous month
Last year
-51%
131,951
Compared to previous year
2
20
Custom react hooks for lodash debounce that provides an easy way to debounce any value, debounced callbacks and types out of the box.
Using yarn or npm:
1yarn add use-lodash-debounce
1npm i use-lodash-debounce
⚠️ react@16.8.0
or greater is required due to the usage of hooks.
Notice that react
and lodash.debounce
are defined as peer dependencies in order to get a smaller bundle size. This means they should be installed in your project.
Debounce values throughout re-renders with useDebounce
. The debounce will be triggered everytime the value changes (compared using strict equality).
1import { useDebounce } from 'use-lodash-debounce' 2 3const [value, setValue] = useState() 4const debouncedValue = useDebounce(value, 800)
Create debounced callbacks with useDebouncedCallback
.
1import { useDebouncedCallback } from 'use-lodash-debounce' 2 3const [value, setValue] = useState() 4const debouncedSetValue = useDebouncedCallback(setValue, 800)
1import { useDebounce } from 'use-lodash-debounce' 2 3function SearchInput() { 4 const [value, setValue] = useState(); 5 const debouncedValue = useDebounce(value, 1000); 6 7 useEffect(() => { 8 // do search stuff 9 }, [debouncedValue]); 10 11 return ( 12 <input 13 placeholder="Type to search" 14 onChange={e => setValue(e.target.value)} 15 /> 16 ); 17}
Lodash debounce supports a set of additional options which can be provided through a third parameter for useDebounce
and useDebouncedCallback
.
1const options = { leading: true, maxWait: 1600, trailing: false } 2const debouncedSetValue = useDebouncedCallback(setValue, 800, options)
See lodash debounce docs for details.
The callback returned by useDebouncedCallback
has a method cancel
to cancel delayed function invocations and a flush
method to immediately invoke them.
If you're looking for a debounce hook that don't use lodash internally, check out use-debounce.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 3/5 approved changesets -- score normalized to 6
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
26 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-06
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More