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

bottleneck

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bottleneck - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

5

bottleneck.js

@@ -18,3 +18,3 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

Bottleneck.prototype._tryToRun = function() {
var done, next, wait;
var done, index, next, wait;
if ((this._nbRunning < this.maxNb || this.maxNb <= 0) && this._queue.length > 0) {

@@ -26,3 +26,3 @@ this._nbRunning++;

done = false;
return this._timeouts.push(setTimeout((function(_this) {
return index = this._timeouts.push(setTimeout((function(_this) {
return function() {

@@ -33,2 +33,3 @@ return next.task.apply({}, next.args.concat(function() {

done = true;
_this._timeouts[index - 1] = null;
_this._nbRunning--;

@@ -35,0 +36,0 @@ _this._tryToRun();

2

bottleneck.min.js

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

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){(function(){var Bottleneck,__slice=[].slice;Bottleneck=function(){function Bottleneck(maxNb,minTime){this.maxNb=maxNb!=null?maxNb:0;this.minTime=minTime!=null?minTime:0;this._nextRequest=Date.now();this._nbRunning=0;this._queue=[];this._timeouts=[]}Bottleneck.prototype._tryToRun=function(){var done,next,wait;if((this._nbRunning<this.maxNb||this.maxNb<=0)&&this._queue.length>0){this._nbRunning++;wait=Math.max(this._nextRequest-Date.now(),0);this._nextRequest=Date.now()+wait+this.minTime;next=this._queue.shift();done=false;return this._timeouts.push(setTimeout(function(_this){return function(){return next.task.apply({},next.args.concat(function(){var _ref;if(!done){done=true;_this._nbRunning--;_this._tryToRun();return(_ref=next.cb)!=null?_ref.apply({},Array.prototype.slice.call(arguments,0)):void 0}}))}}(this),wait))}};Bottleneck.prototype.submit=function(){var args,cb,task,_i;task=arguments[0],args=3<=arguments.length?__slice.call(arguments,1,_i=arguments.length-1):(_i=1,[]),cb=arguments[_i++];this._queue.push({task:task,args:args,cb:cb});return this._tryToRun()};Bottleneck.prototype.changeSettings=function(maxNb,minTime){this.maxNb=maxNb!=null?maxNb:this.maxNb;this.minTime=minTime!=null?minTime:this.minTime;return this};Bottleneck.prototype.stopAll=function(){var a,_i,_len,_ref;_ref=this._timeouts;for(_i=0,_len=_ref.length;_i<_len;_i++){a=_ref[_i];clearTimeout(a)}return this._tryToRun=function(){}};return Bottleneck}();module.exports=Bottleneck}).call(this)},{}],2:[function(require,module,exports){(function(global){(function(){module.exports=require("./Bottleneck");if(global.window!=null){global.window.Bottleneck=module.exports}}).call(this)}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./Bottleneck":1}]},{},[2]);
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){(function(){var Bottleneck,__slice=[].slice;Bottleneck=function(){function Bottleneck(maxNb,minTime){this.maxNb=maxNb!=null?maxNb:0;this.minTime=minTime!=null?minTime:0;this._nextRequest=Date.now();this._nbRunning=0;this._queue=[];this._timeouts=[]}Bottleneck.prototype._tryToRun=function(){var done,index,next,wait;if((this._nbRunning<this.maxNb||this.maxNb<=0)&&this._queue.length>0){this._nbRunning++;wait=Math.max(this._nextRequest-Date.now(),0);this._nextRequest=Date.now()+wait+this.minTime;next=this._queue.shift();done=false;return index=this._timeouts.push(setTimeout(function(_this){return function(){return next.task.apply({},next.args.concat(function(){var _ref;if(!done){done=true;_this._timeouts[index-1]=null;_this._nbRunning--;_this._tryToRun();return(_ref=next.cb)!=null?_ref.apply({},Array.prototype.slice.call(arguments,0)):void 0}}))}}(this),wait))}};Bottleneck.prototype.submit=function(){var args,cb,task,_i;task=arguments[0],args=3<=arguments.length?__slice.call(arguments,1,_i=arguments.length-1):(_i=1,[]),cb=arguments[_i++];this._queue.push({task:task,args:args,cb:cb});return this._tryToRun()};Bottleneck.prototype.changeSettings=function(maxNb,minTime){this.maxNb=maxNb!=null?maxNb:this.maxNb;this.minTime=minTime!=null?minTime:this.minTime;return this};Bottleneck.prototype.stopAll=function(){var a,_i,_len,_ref;_ref=this._timeouts;for(_i=0,_len=_ref.length;_i<_len;_i++){a=_ref[_i];clearTimeout(a)}return this._tryToRun=function(){}};return Bottleneck}();module.exports=Bottleneck}).call(this)},{}],2:[function(require,module,exports){(function(global){(function(){module.exports=require("./Bottleneck");if(global.window!=null){global.window.Bottleneck=module.exports}}).call(this)}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./Bottleneck":1}]},{},[2]);

@@ -17,3 +17,3 @@ // Generated by CoffeeScript 1.7.1

Bottleneck.prototype._tryToRun = function() {
var done, next, wait;
var done, index, next, wait;
if ((this._nbRunning < this.maxNb || this.maxNb <= 0) && this._queue.length > 0) {

@@ -25,3 +25,3 @@ this._nbRunning++;

done = false;
return this._timeouts.push(setTimeout((function(_this) {
return index = this._timeouts.push(setTimeout((function(_this) {
return function() {

@@ -32,2 +32,3 @@ return next.task.apply({}, next.args.concat(function() {

done = true;
_this._timeouts[index - 1] = null;
_this._nbRunning--;

@@ -34,0 +35,0 @@ _this._tryToRun();

{
"name": "bottleneck",
"version": "1.1.0",
"version": "1.1.1",
"description": "Async rate limiter",

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

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