From 70012f5574cc204493d77c56517f4a765f65f950 Mon Sep 17 00:00:00 2001 From: Thaddee Tyl Date: Thu, 20 Nov 2014 23:52:44 +0100 Subject: [PATCH] Default LRU cache size type is a unit --- lru-cache.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lru-cache.js b/lru-cache.js index d3b451b..7e08f65 100644 --- a/lru-cache.js +++ b/lru-cache.js @@ -8,6 +8,7 @@ var typeEnum = { function Cache(size, type) { if (!this instanceof Cache) { return new Cache(size, type); } + type = type || 'unit'; this.size = size; this.type = typeEnum[type]; // `cache` contains {content, index}. @@ -68,7 +69,7 @@ Cache.prototype = { return (this.order.length >> 1); } else { return 0; } } else { - console.error("Unknown heuristic for LRU cache."); + console.error("Unknown heuristic '" + this.type + "' for LRU cache."); return 1; } },