Comparing version 1.4.7 to 1.4.8
@@ -0,0 +0,0 @@ { |
var path = require("path"); | ||
module.exports = require(path.join(__dirname, "lib", Number(process.version.replace("v", "").split(".")[0]) >= 6 ? "tiny-lru.es6" : "tiny-lru")); |
@@ -8,3 +8,3 @@ /** | ||
* @link https://github.com/avoidwork/tiny-lru | ||
* @version 1.4.7 | ||
* @version 1.4.8 | ||
*/ | ||
@@ -86,4 +86,5 @@ "use strict"; | ||
remove (key, silent = false) { | ||
let cached = this.cache[key]; | ||
remove (k, silent = false) { | ||
let key = typeof k !== "string" ? k.toString() : k, | ||
cached = this.cache[key]; | ||
@@ -131,3 +132,3 @@ if (cached) { | ||
set (key, value) { | ||
let item; | ||
let first, item; | ||
@@ -139,2 +140,6 @@ if (this.has(key)) { | ||
item.previous = this.first; | ||
if (this.last === key) { | ||
this.last = item.previous; | ||
} | ||
} else { | ||
@@ -157,3 +162,8 @@ if (++this.length > this.max) { | ||
if (this.first) { | ||
this.cache[this.first].next = key; | ||
first = this.cache[this.first]; | ||
first.next = key; | ||
if (first.previous === key) { | ||
first.previous = null; | ||
} | ||
} | ||
@@ -160,0 +170,0 @@ |
@@ -8,3 +8,3 @@ /** | ||
* @link https://github.com/avoidwork/tiny-lru | ||
* @version 1.4.7 | ||
* @version 1.4.8 | ||
*/ | ||
@@ -108,6 +108,7 @@ "use strict"; | ||
key: "remove", | ||
value: function remove(key) { | ||
value: function remove(k) { | ||
var silent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
var cached = this.cache[key]; | ||
var key = typeof k !== "string" ? k.toString() : k, | ||
cached = this.cache[key]; | ||
@@ -156,3 +157,4 @@ if (cached) { | ||
value: function set(key, value) { | ||
var item = void 0; | ||
var first = void 0, | ||
item = void 0; | ||
@@ -164,2 +166,6 @@ if (this.has(key)) { | ||
item.previous = this.first; | ||
if (this.last === key) { | ||
this.last = item.previous; | ||
} | ||
} else { | ||
@@ -182,3 +188,8 @@ if (++this.length > this.max) { | ||
if (this.first) { | ||
this.cache[this.first].next = key; | ||
first = this.cache[this.first]; | ||
first.next = key; | ||
if (first.previous === key) { | ||
first.previous = null; | ||
} | ||
} | ||
@@ -185,0 +196,0 @@ |
{ | ||
"name": "tiny-lru", | ||
"description": "Tiny LRU cache for Client or Server", | ||
"version": "1.4.7", | ||
"version": "1.4.8", | ||
"homepage": "https://github.com/avoidwork/tiny-lru", | ||
@@ -6,0 +6,0 @@ "author": "Jason Mulligan <jason.mulligan@avoidwork.com>", |
@@ -0,0 +0,0 @@ # Tiny LRU |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
370
14653