Comparing version 4.0.3 to 4.0.4
@@ -8,3 +8,3 @@ /** | ||
* @link https://github.com/avoidwork/tiny-lru | ||
* @version 4.0.3 | ||
* @version 4.0.4 | ||
*/ | ||
@@ -17,9 +17,7 @@ "use strict"; | ||
function link (item, key, dir) { | ||
const other = dir === "next" ? "previous" : "next"; | ||
function link (item, key, a, b) { | ||
item[a] = key; | ||
item[dir] = key; | ||
if (item[other] === key) { | ||
item[other] = empty; | ||
if (item[b] === key) { | ||
item[b] = empty; | ||
} | ||
@@ -152,11 +150,11 @@ } | ||
item.previous = this.first; | ||
link(this.cache[this.first], key, "next"); | ||
link(this.cache[this.first], key, "next", "previous"); | ||
} | ||
if (right !== empty && left !== empty && right !== item.previous) { | ||
link(this.cache[right], left, "next"); | ||
this.cache[right].next = left; | ||
} | ||
if (left !== empty) { | ||
link(this.cache[left], right, "previous"); | ||
this.cache[left].previous = right; | ||
} | ||
@@ -185,3 +183,3 @@ | ||
if (this.first !== empty && this.first !== key) { | ||
link(this.cache[this.first], key, "next"); | ||
link(this.cache[this.first], key, "next", "previous"); | ||
} | ||
@@ -188,0 +186,0 @@ } |
{ | ||
"name": "tiny-lru", | ||
"description": "Tiny LRU cache for Client or Server", | ||
"version": "4.0.3", | ||
"version": "4.0.4", | ||
"homepage": "https://github.com/avoidwork/tiny-lru", | ||
@@ -6,0 +6,0 @@ "author": "Jason Mulligan <jason.mulligan@avoidwork.com>", |
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
10107
200