Socket
Socket
Sign inDemoInstall

lru-cache

Package Overview
Dependencies
Maintainers
1
Versions
142
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 2.0.3 to 2.0.4

24

lib/lru-cache.js
;(function () { // closure for web browsers
if (module) {
if (typeof module === 'object' && module.exports) {
module.exports = LRUCache

@@ -24,3 +24,3 @@ } else {

max = options
options = {max: max}
options = { max: max }
}

@@ -37,2 +37,3 @@ max = options.max

if (!max || !(typeof max === "number") || max <= 0 ) {
// a little bit silly. maybe this should throw?
max = Infinity

@@ -129,9 +130,5 @@ }

var hit = {
key:key,
value:value,
lu:mru++,
length:lengthCalculator(value),
now: (maxAge) ? Date.now() : 0
}
var len = lengthCalculator(value)
var age = maxAge ? Date.now() : 0
var hit = new Entry(key, value, mru++, len, age)

@@ -188,2 +185,11 @@ // oversized objects fall out of cache automatically.

// classy, since V8 prefers predictable objects.
function Entry (key, value, mru, len, age) {
this.key = key
this.value = value
this.lu = mru
this.length = len
this.now = age
}
})()
{
"name": "lru-cache",
"description": "A cache object that deletes the least-recently-used items.",
"version": "2.0.3",
"version": "2.0.4",
"author": "Isaac Z. Schlueter <i@izs.me>",

@@ -6,0 +6,0 @@ "scripts": {

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