destructuring array assignment
This commit is contained in:
@@ -55,11 +55,7 @@ function rateLimitMiddleware(metadataBackend, endpointGroup = null) {
|
||||
return next();
|
||||
}
|
||||
|
||||
const isBloqued = rateLimit[0];
|
||||
const limit = rateLimit[1];
|
||||
const remaining = rateLimit[2];
|
||||
const retry = rateLimit[3];
|
||||
const reset = rateLimit[4];
|
||||
const [isBloqued, limit, remaining, retry, reset] = rateLimit;
|
||||
|
||||
res.set({
|
||||
'X-Rate-Limit-Limit': limit,
|
||||
@@ -139,7 +135,7 @@ function getLuaScript() {
|
||||
* isBloqued, limit, remaining, retry, reset
|
||||
*/
|
||||
function getLowerRateLimit(ratelimits) {
|
||||
/*jshint maxcomplexity:10 */
|
||||
/*jshint maxcomplexity:10 */
|
||||
if (!ratelimits || !Array.isArray(ratelimits) || !ratelimits.length) {
|
||||
return;
|
||||
}
|
||||
@@ -158,7 +154,7 @@ function getLowerRateLimit(ratelimits) {
|
||||
minIndex = currentIndex;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (minValue === undefined || ratelimit[2] < minValue) {
|
||||
// smaller remaining
|
||||
minIndex = currentIndex;
|
||||
|
||||
Reference in New Issue
Block a user