Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
debounce-queue
Advanced tools
Like lodash.debounce but you get an array of all previous (unique) events
Like lodash.debounce
but you get an array of all previous (unique) events instead of just the last/first one.
import {watch} from 'chokidar';
import debounce from 'debounce-queue';
function onChange(files) {
// files is now an array of (unique) files that were changed since (t-1000)ms
}
const debounced = debounce(onChange, 1000);
watch('.')
.on('change', debounced)
You can customize which items get enqueued:
const debounced = debounce(onChange, 1000, {
enqueue( data, queue, defaultEnqueue ) {
if ( queue.indexOf( data ) === -1 ) {
queue.push( data )
}
return queue;
}
});
sleep
(boolean) (default: false)Sleeps while callback is being awaited. Helps prevent feedback loop when a process modifies files in the same path it's watching for changes.
Be sure to return a promise in your callback.
Your debounced function can return a promise
function onChange(files) {
return Promise.map(files, () => {
return Promise.delay(1000);
});
// Next onChange will fire after `delay + files.length * 1000` ms
}
FAQs
Like lodash.debounce but you get an array of all previous (unique) events
We found that debounce-queue demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.