diff options
author | Gar <gar+gh@danger.computer> | 2022-04-06 19:24:11 +0300 |
---|---|---|
committer | Gar <wraithgar@github.com> | 2022-04-07 00:29:40 +0300 |
commit | c44c2b02920854897ba7a663ef705b9b474c2250 (patch) | |
tree | 3435fdbe73626c621524a27ff7f57ba0313148e8 /node_modules | |
parent | 69d834319a9d668bd451600ab6e124a8819b284d (diff) |
deps: lru-cache@7.7.3
Diffstat (limited to 'node_modules')
-rw-r--r-- | node_modules/lru-cache/index.js | 19 | ||||
-rw-r--r-- | node_modules/lru-cache/package.json | 4 |
2 files changed, 15 insertions, 8 deletions
diff --git a/node_modules/lru-cache/index.js b/node_modules/lru-cache/index.js index 978b8f4ee..2168fd3a6 100644 --- a/node_modules/lru-cache/index.js +++ b/node_modules/lru-cache/index.js @@ -127,7 +127,7 @@ class LRUCache { throw new TypeError('cannot set sizeCalculation without setting maxSize') } if (typeof this.sizeCalculation !== 'function') { - throw new TypeError('sizeCalculating set to non-function') + throw new TypeError('sizeCalculation set to non-function') } } @@ -273,11 +273,18 @@ class LRUCache { this.sizes = new ZeroArray(this.max) this.removeItemSize = index => this.calculatedSize -= this.sizes[index] 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)') + } } return size } @@ -559,7 +566,7 @@ class LRUCache { if (this.isBackgroundFetch(v)) { return v } - const ac = new AbortController() + const ac = new AC() const fetchOpts = { signal: ac.signal, options, diff --git a/node_modules/lru-cache/package.json b/node_modules/lru-cache/package.json index 84d199c2b..ca75abf00 100644 --- a/node_modules/lru-cache/package.json +++ b/node_modules/lru-cache/package.json @@ -1,7 +1,7 @@ { "name": "lru-cache", "description": "A cache object that deletes the least-recently-used items.", - "version": "7.7.1", + "version": "7.7.3", "author": "Isaac Z. Schlueter <i@izs.me>", "keywords": [ "mru", @@ -22,7 +22,7 @@ "devDependencies": { "@size-limit/preset-small-lib": "^7.0.8", "benchmark": "^2.1.4", - "clock-mock": "^1.0.3", + "clock-mock": "^1.0.4", "size-limit": "^7.0.8", "tap": "^15.1.6" }, |