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

debounce-queue

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

debounce-queue - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

17

index.js

@@ -1,3 +0,1 @@

const defaultEnqueue = require('./enqueue');
module.exports = function debounceQueue(callback, opts = {}) {

@@ -17,19 +15,8 @@ if (typeof callback !== 'function') {

const enqueue = opts.enqueue || defaultEnqueue;
const maxWait = opts.maxWait || (delay + 2000);
let time = new Date();
function debounced(data) {
function debounced(...args) {
if (sleeping) return;
const queueCopy = queue.slice()
const ret = enqueue(data, queueCopy, (_data = data, queue = queueCopy) => defaultEnqueue(_data, queue));
if (!(ret instanceof Array)) {
throw new Error('opts.enqueue must return a modified queue array');
} else {
// if (ret.length < queue.length) {
// console.warn('WARNING: Returned queue has fewer items than the original');
// }
queue = ret;
}
queue.push(args);
if (new Date(time + maxWait) < new Date()) {

@@ -36,0 +23,0 @@ setNextTimer();

2

package.json
{
"name": "debounce-queue",
"version": "0.2.2",
"version": "0.3.0",
"description": "Like lodash.debounce but you get an array of all previous (unique) events",
"repository": "laggingreflex/debounce-queue"
}
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