rate-limiter-flexible
Advanced tools
Comparing version 2.3.7 to 2.3.8
@@ -51,3 +51,3 @@ const RateLimiterAbstract = require('./RateLimiterAbstract'); | ||
const res = this._memoryStorage.incrby(rlKey, points, secDuration); | ||
res.remainingPoints = this.points - res.consumedPoints; | ||
res.remainingPoints = Math.max(this.points - res.consumedPoints, 0); | ||
resolve(res); | ||
@@ -62,3 +62,3 @@ }); | ||
const res = this._memoryStorage.incrby(rlKey, -points, secDuration); | ||
res.remainingPoints = this.points - res.consumedPoints; | ||
res.remainingPoints = Math.max(this.points - res.consumedPoints, 0); | ||
resolve(res); | ||
@@ -96,3 +96,3 @@ }); | ||
if (res !== null) { | ||
res.remainingPoints = this.points - res.consumedPoints; | ||
res.remainingPoints = Math.max(this.points - res.consumedPoints, 0); | ||
} | ||
@@ -99,0 +99,0 @@ |
{ | ||
"name": "rate-limiter-flexible", | ||
"version": "2.3.7", | ||
"version": "2.3.8", | ||
"description": "Node.js rate limiter by key and protection from DDoS and Brute-Force attacks in process Memory, Redis, MongoDb, Memcached, MySQL, PostgreSQL, Cluster or PM", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -45,2 +45,4 @@ [![Coverage Status](https://coveralls.io/repos/animir/node-rate-limiter-flexible/badge.svg?branch=master)](https://coveralls.io/r/animir/node-rate-limiter-flexible?branch=master) | ||
Points can be consumed by IP address, user ID, authorisation token, API route or any other string. | ||
```javascript | ||
@@ -47,0 +49,0 @@ const opts = { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
120710
237