Skip to content

Commit

Permalink
deps: lru-cache@7.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Apr 6, 2022
1 parent 69d8343 commit c44c2b0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
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 <i@izs.me>",
"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

0 comments on commit c44c2b0

Please sign in to comment.