lru-cache
Advanced tools
Comparing version 7.7.1 to 7.7.2
17
index.js
@@ -276,7 +276,14 @@ const perf = typeof performance === 'object' && performance && | ||
this.requireSize = (k, v, size, sizeCalculation) => { | ||
if (sizeCalculation && !size) { | ||
size = sizeCalculation(v, k) | ||
} | ||
if (!isPosInt(size)) { | ||
throw new TypeError('size must be positive integer') | ||
if (sizeCalculation) { | ||
if (typeof sizeCalculation !== 'function') { | ||
throw new TypeError('sizeCalculation must be a function') | ||
} | ||
size = sizeCalculation(v, k) | ||
if (!isPosInt(size)) { | ||
throw new TypeError('sizeCalculation return invalid (expect positive integer)') | ||
} | ||
} else { | ||
throw new TypeError('invalid size value (must be positive integer)') | ||
} | ||
} | ||
@@ -563,3 +570,3 @@ return size | ||
} | ||
const ac = new AbortController() | ||
const ac = new AC() | ||
const fetchOpts = { | ||
@@ -566,0 +573,0 @@ signal: ac.signal, |
{ | ||
"name": "lru-cache", | ||
"description": "A cache object that deletes the least-recently-used items.", | ||
"version": "7.7.1", | ||
"version": "7.7.2", | ||
"author": "Isaac Z. Schlueter <i@izs.me>", | ||
@@ -25,3 +25,3 @@ "keywords": [ | ||
"benchmark": "^2.1.4", | ||
"clock-mock": "^1.0.3", | ||
"clock-mock": "^1.0.4", | ||
"size-limit": "^7.0.8", | ||
@@ -28,0 +28,0 @@ "tap": "^15.1.6" |
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
49352
732