rate-limiter-flexible
Advanced tools
Comparing version 2.3.3 to 2.3.4
@@ -7,17 +7,18 @@ const RateLimiterStoreAbstract = require('./RateLimiterStoreAbstract'); | ||
* @params {Object} Client instance | ||
* @returns {Number|undefined} Major version | ||
* @returns {Object} Version Object containing major, feature & minor versions. | ||
*/ | ||
function getDriverVersion(client) { | ||
try { | ||
let version; | ||
if (client.client) { | ||
({ version } = client.client.topology.s.options.metadata.driver); | ||
} else { | ||
({ version } = client.topology.s.options.metadata.driver); | ||
} | ||
const majorVersion = parseInt(version); | ||
const _client = client.client ? client.client : client; | ||
return majorVersion; | ||
const { version } = _client.topology.s.options.metadata.driver; | ||
const _v = version.split('.').map(v => parseInt(v)); | ||
return { | ||
major: _v[0], | ||
feature: _v[1], | ||
patch: _v[2], | ||
}; | ||
} catch (err) { | ||
return undefined; | ||
return { major: 0, feature: 0, patch: 0 }; | ||
} | ||
@@ -178,3 +179,8 @@ } | ||
}; | ||
if (this._driverVersion >= 4) { | ||
if ((this._driverVersion.major >= 4) || | ||
(this._driverVersion.major === 3 && | ||
(this._driverVersion.feature >=7) || | ||
(this._driverVersion.feature >= 6 && | ||
this._driverVersion.patch >= 7 ))) | ||
{ | ||
upsertOptions.returnDocument = 'after'; | ||
@@ -181,0 +187,0 @@ } else { |
{ | ||
"name": "rate-limiter-flexible", | ||
"version": "2.3.3", | ||
"version": "2.3.4", | ||
"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", |
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
120086
3270