Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
  • Loading branch information
wraithgar committed Apr 6, 2022
commit 2a95e6b2914d074e2e9897b14ca4a0f9b21abd5f
19 changes: 13 additions & 6 deletions node_modules/lru-cache/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
}

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions node_modules/lru-cache/package.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
"keywords": [
"mru",
Expand All @@ -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"
},
Expand Down
9 changes: 6 additions & 3 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -4525,9 +4525,10 @@
}
},
"node_modules/lru-cache": {
"version": "7.7.1",
"version": "7.7.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.7.3.tgz",
"integrity": "sha512-WY9wjJNQt9+PZilnLbuFKM+SwDull9+6IAguOrarOMoOHTcJ9GnXSO11+Gw6c7xtDkBkthR57OZMtZKYr+1CEw==",
"inBundle": true,
"license": "ISC",
"engines": {
"node": ">=12"
}
Expand Down Expand Up @@ -12859,7 +12860,9 @@
"peer": true
},
"lru-cache": {
"version": "7.7.1"
"version": "7.7.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.7.3.tgz",
"integrity": "sha512-WY9wjJNQt9+PZilnLbuFKM+SwDull9+6IAguOrarOMoOHTcJ9GnXSO11+Gw6c7xtDkBkthR57OZMtZKYr+1CEw=="
},
"make-dir": {
"version": "3.1.0",
Expand Down