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.9.0 to 7.9.1

26

index.js

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

}
const p = Promise.resolve(this.fetchMethod(k, v, fetchOpts)).then(v => {
const cb = v => {
if (!ac.signal.aborted) {

@@ -627,5 +627,16 @@ this.set(k, v, fetchOpts.options)

return v
})
}
const eb = er => {
if (this.valList[index] === p) {
this.delete(k)
}
if (p.__returned === p) {
throw er
}
}
const pcall = res => res(this.fetchMethod(k, v, fetchOpts))
const p = new Promise(pcall).then(cb, eb)
p.__abortController = ac
p.__staleWhileFetching = v
p.__returned = null
if (index === undefined) {

@@ -642,3 +653,5 @@ this.set(k, p, fetchOpts.options)

return p && typeof p === 'object' && typeof p.then === 'function' &&
Object.prototype.hasOwnProperty.call(p, '__staleWhileFetching')
Object.prototype.hasOwnProperty.call(p, '__staleWhileFetching') &&
Object.prototype.hasOwnProperty.call(p, '__returned') &&
(p.__returned === p || p.__returned === null)
}

@@ -672,3 +685,4 @@

if (index === undefined) {
return this.backgroundFetch(k, index, options)
const p = this.backgroundFetch(k, index, options)
return (p.__returned = p)
} else {

@@ -679,3 +693,3 @@ // in cache, maybe already fetching

return allowStale && v.__staleWhileFetching !== undefined
? v.__staleWhileFetching : v
? v.__staleWhileFetching : (v.__returned = v)
}

@@ -695,3 +709,3 @@

return allowStale && p.__staleWhileFetching !== undefined
? p.__staleWhileFetching : p
? p.__staleWhileFetching : (p.__returned = p)
}

@@ -698,0 +712,0 @@ }

{
"name": "lru-cache",
"description": "A cache object that deletes the least-recently-used items.",
"version": "7.9.0",
"version": "7.9.1",
"author": "Isaac Z. Schlueter <i@izs.me>",

@@ -6,0 +6,0 @@ "keywords": [

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