Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lru-cache

Package Overview
Dependencies
Maintainers
1
Versions
143
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lru-cache - npm Package Compare versions

Comparing version 7.6.0 to 7.6.1

22

index.js

@@ -64,3 +64,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)

@@ -129,3 +132,2 @@ this.length = 0

this.keyMap = new Map()

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

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

@@ -496,4 +498,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)
}

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

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

@@ -516,3 +518,3 @@ }

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

@@ -526,2 +528,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]

@@ -528,0 +536,0 @@ this.keyMap.delete(k)

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

@@ -25,5 +28,6 @@ "keywords": [

"benchmark": "^2.1.4",
"clock-mock": "^1.0.3",
"clock-mock": "^1.0.4",
"heapdump": "^0.3.15",
"size-limit": "^7.0.8",
"tap": "^15.1.6"
"tap": "^16.0.1"
},

@@ -38,3 +42,6 @@ "license": "ISC",

"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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc