Skip to content

Commit c44c2b0

Browse files
committed
1 parent 69d8343 commit c44c2b0

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

node_modules/lru-cache/index.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class LRUCache {
127127
throw new TypeError('cannot set sizeCalculation without setting maxSize')
128128
}
129129
if (typeof this.sizeCalculation !== 'function') {
130-
throw new TypeError('sizeCalculating set to non-function')
130+
throw new TypeError('sizeCalculation set to non-function')
131131
}
132132
}
133133

@@ -273,11 +273,18 @@ class LRUCache {
273273
this.sizes = new ZeroArray(this.max)
274274
this.removeItemSize = index => this.calculatedSize -= this.sizes[index]
275275
this.requireSize = (k, v, size, sizeCalculation) => {
276-
if (sizeCalculation && !size) {
277-
size = sizeCalculation(v, k)
278-
}
279276
if (!isPosInt(size)) {
280-
throw new TypeError('size must be positive integer')
277+
if (sizeCalculation) {
278+
if (typeof sizeCalculation !== 'function') {
279+
throw new TypeError('sizeCalculation must be a function')
280+
}
281+
size = sizeCalculation(v, k)
282+
if (!isPosInt(size)) {
283+
throw new TypeError('sizeCalculation return invalid (expect positive integer)')
284+
}
285+
} else {
286+
throw new TypeError('invalid size value (must be positive integer)')
287+
}
281288
}
282289
return size
283290
}
@@ -559,7 +566,7 @@ class LRUCache {
559566
if (this.isBackgroundFetch(v)) {
560567
return v
561568
}
562-
const ac = new AbortController()
569+
const ac = new AC()
563570
const fetchOpts = {
564571
signal: ac.signal,
565572
options,

node_modules/lru-cache/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "lru-cache",
33
"description": "A cache object that deletes the least-recently-used items.",
4-
"version": "7.7.1",
4+
"version": "7.7.3",
55
"author": "Isaac Z. Schlueter <[email protected]>",
66
"keywords": [
77
"mru",
@@ -22,7 +22,7 @@
2222
"devDependencies": {
2323
"@size-limit/preset-small-lib": "^7.0.8",
2424
"benchmark": "^2.1.4",
25-
"clock-mock": "^1.0.3",
25+
"clock-mock": "^1.0.4",
2626
"size-limit": "^7.0.8",
2727
"tap": "^15.1.6"
2828
},

package-lock.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4525,9 +4525,10 @@
45254525
}
45264526
},
45274527
"node_modules/lru-cache": {
4528-
"version": "7.7.1",
4528+
"version": "7.7.3",
4529+
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.7.3.tgz",
4530+
"integrity": "sha512-WY9wjJNQt9+PZilnLbuFKM+SwDull9+6IAguOrarOMoOHTcJ9GnXSO11+Gw6c7xtDkBkthR57OZMtZKYr+1CEw==",
45294531
"inBundle": true,
4530-
"license": "ISC",
45314532
"engines": {
45324533
"node": ">=12"
45334534
}
@@ -12859,7 +12860,9 @@
1285912860
"peer": true
1286012861
},
1286112862
"lru-cache": {
12862-
"version": "7.7.1"
12863+
"version": "7.7.3",
12864+
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.7.3.tgz",
12865+
"integrity": "sha512-WY9wjJNQt9+PZilnLbuFKM+SwDull9+6IAguOrarOMoOHTcJ9GnXSO11+Gw6c7xtDkBkthR57OZMtZKYr+1CEw=="
1286312866
},
1286412867
"make-dir": {
1286512868
"version": "3.1.0",

0 commit comments

Comments
 (0)