Socket
Socket
Sign inDemoInstall

lru-cache

Package Overview
Dependencies
0
Maintainers
1
Versions
133
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.6.0 to 2.6.1

18

lib/lru-cache.js

@@ -151,8 +151,12 @@ ;(function () { // closure for web browsers

LRUCache.prototype.set = function (key, value, maxAge) {
maxAge = maxAge || this._maxAge
var now = maxAge ? Date.now() : 0
if (hOP(this._cache, key)) {
// dispose of the old one before overwriting
if (this._dispose) this._dispose(key, this._cache[key].value)
if (maxAge || this._maxAge) this._cache[key].now = Date.now()
delete this._cache[key]['maxAge']
if (maxAge) this._cache[key].maxAge = maxAge
if (this._dispose)
this._dispose(key, this._cache[key].value)
this._cache[key].now = now
this._cache[key].maxAge = maxAge
this._cache[key].value = value

@@ -164,4 +168,2 @@ this.get(key)

var len = this._lengthCalculator(value)
var now = (maxAge || this._maxAge) ? Date.now() : 0
var maxAge = maxAge || this._maxAge
var hit = new Entry(key, value, this._mru++, len, now, maxAge)

@@ -179,3 +181,5 @@

if (this._length > this._max) trim(this)
if (this._length > this._max)
trim(this)
return true

@@ -182,0 +186,0 @@ }

{
"name": "lru-cache",
"description": "A cache object that deletes the least-recently-used items.",
"version": "2.6.0",
"version": "2.6.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