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

just-throttle

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

just-throttle - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

LICENSE

15

index.js
module.exports = throttle;
function throttle (fn, interval, immediate) {
function throttle(fn, interval, callFirst) {
var wait = false;
var callNow = false;
return function () {
var callNow = immediate && !wait;
return function() {
callNow = callFirst && !wait;
var context = this;

@@ -12,11 +12,14 @@ var args = arguments;

wait = true;
setTimeout(function () {
setTimeout(function() {
wait = false;
return fn.apply(context, args);
if (!callFirst) {
return fn.apply(context, args);
}
}, interval);
}
if (callNow) {
callNow = false;
return fn.apply(this, arguments);
}
}
};
}

2

package.json
{
"name": "just-throttle",
"version": "1.0.2",
"version": "1.1.0",
"description": "return a throttled function",

@@ -5,0 +5,0 @@ "main": "index.js",

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