Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

speed-limiter

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

speed-limiter - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

9

lib/throttle-group.js

@@ -18,3 +18,2 @@ const { TokenBucket } = require('limiter')

getRate () {
if (!this.bucket) return null
// Note: bucketSize === tokensPerInterval

@@ -70,4 +69,2 @@ return this.bucket.tokensPerInterval

this.throttles.push(newThrottle)
return newThrottle

@@ -84,2 +81,8 @@ }

_addThrottle (throttle) {
if (!(throttle instanceof Throttle)) throw new Error('Throttle must be an instance of Throttle')
this.throttles.push(throttle)
}
_removeThrottle (throttle) {

@@ -86,0 +89,0 @@ const index = this.throttles.indexOf(throttle)

@@ -16,6 +16,8 @@ const { EventEmitter } = require('events')

this._setEnabled(params.enabled || params.group.enabled)
this._group = params.group
this._events = new EventEmitter()
this._group = params.group
this._destroyed = false
this.setEnabled(params.enabled || params.group.enabled)
this._group._addThrottle(this)
}

@@ -31,6 +33,9 @@

setEnabled (val = true) {
_setEnabled (val = true) {
if (typeof val !== 'boolean') throw new Error('Enabled must be a boolean')
this._enabled = val
}
setEnabled (val) {
this._setEnabled(val)
if (this._enabled) this._events.emit('enabled')

@@ -37,0 +42,0 @@ else this._events.emit('disabled')

{
"name": "speed-limiter",
"version": "0.2.3",
"version": "0.2.4",
"description": "Throttle the speed of streams",

@@ -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