Socket
Socket
Sign inDemoInstall

lru-cache

Package Overview
Dependencies
0
Maintainers
1
Versions
134
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.7.3 to 7.7.4

22

index.js

@@ -75,3 +75,6 @@ const perf = typeof performance === 'object' && performance &&

constructor (max) {
const UintArray = max ? getUintArray(max) : Array
if (max === 0) {
return []
}
const UintArray = getUintArray(max)
this.heap = new UintArray(max)

@@ -140,3 +143,2 @@ this.length = 0

this.keyMap = new Map()

@@ -297,3 +299,3 @@ this.keyList = new Array(max).fill(null)

while (this.calculatedSize > maxSize) {
this.evict()
this.evict(true)
}

@@ -518,4 +520,4 @@ this.calculatedSize += this.sizes[index]

}
if (this.size === this.max) {
return this.evict()
if (this.size === this.max && this.max !== 0) {
return this.evict(false)
}

@@ -532,3 +534,3 @@ if (this.free.length !== 0) {

const val = this.valList[this.head]
this.evict()
this.evict(true)
return val

@@ -538,3 +540,3 @@ }

evict () {
evict (free) {
const head = this.head

@@ -552,2 +554,8 @@ const k = this.keyList[head]

this.removeItemSize(head)
// if we aren't about to use the index, then null these out
if (free) {
this.keyList[head] = null
this.valList[head] = null
this.free.push(head)
}
this.head = this.next[head]

@@ -554,0 +562,0 @@ this.keyMap.delete(k)

{
"name": "lru-cache",
"description": "A cache object that deletes the least-recently-used items.",
"version": "7.7.3",
"version": "7.7.4",
"publishConfig": {
"tag": "v7.7-backport"
},
"author": "Isaac Z. Schlueter <i@izs.me>",

@@ -26,2 +29,3 @@ "keywords": [

"clock-mock": "^1.0.4",
"heapdump": "^0.3.15",
"size-limit": "^7.0.8",

@@ -38,3 +42,6 @@ "tap": "^15.1.6"

"tap": {
"coverage-map": "map.js"
"coverage-map": "map.js",
"node-arg": [
"--expose-gc"
]
},

@@ -41,0 +48,0 @@ "size-limit": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc