lru-cache
Advanced tools
Comparing version 2.0.3 to 2.0.4
;(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": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
394
13954
7