lru-cache
Advanced tools
Comparing version 2.7.1 to 2.7.2
@@ -217,3 +217,5 @@ ;(function () { // closure for web browsers | ||
LRUCache.prototype.has = function (key) { | ||
typeCheckKey(key) | ||
if (typeof key !== 'string' && typeof key !== 'number') | ||
return false | ||
if (!hOP(this._cache, key)) return false | ||
@@ -228,3 +230,4 @@ var hit = this._cache[key] | ||
LRUCache.prototype.get = function (key) { | ||
typeCheckKey(key) | ||
if (typeof key !== 'string' && typeof key !== 'number') | ||
return | ||
return get(this, key, true) | ||
@@ -234,3 +237,4 @@ } | ||
LRUCache.prototype.peek = function (key) { | ||
typeCheckKey(key) | ||
if (typeof key !== 'string' && typeof key !== 'number') | ||
return | ||
return get(this, key, false) | ||
@@ -246,3 +250,4 @@ } | ||
LRUCache.prototype.del = function (key) { | ||
typeCheckKey(key) | ||
if (typeof key !== 'string' && typeof key !== 'number') | ||
return | ||
del(this, this._cache[key]) | ||
@@ -249,0 +254,0 @@ } |
{ | ||
"name": "lru-cache", | ||
"description": "A cache object that deletes the least-recently-used items.", | ||
"version": "2.7.1", | ||
"version": "2.7.2", | ||
"author": "Isaac Z. Schlueter <i@izs.me>", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -412,13 +412,5 @@ var test = require("tap").test | ||
t.throws(function() { | ||
cache.get({ someObjectKey: true }) | ||
}, "get should not accept objects as keys") | ||
t.throws(function() { | ||
cache.set([1,2,3], "b") | ||
}, "set should not accept arrays as keys") | ||
t.throws(function() { | ||
cache.get([1,2,3]) | ||
}, "get should not accept arrays as keys") | ||
t.end() | ||
@@ -435,11 +427,2 @@ }) | ||
t.equal(cache.peek(123), 456) | ||
t.throws(function() { | ||
cache.peek({ someObjectKey: true }) | ||
}, "peek should not accept objects as keys") | ||
t.throws(function() { | ||
cache.peek([1,2,3]) | ||
}, "peek should not accept arrays as keys") | ||
t.end() | ||
@@ -460,10 +443,6 @@ }) | ||
t.throws(function() { | ||
cache.del({ someObjectKey: true }) | ||
}, "del should not accept objects as keys") | ||
cache.set('[object Object]', 123) | ||
t.assertNot(cache.has({})) | ||
t.assert(cache.has(String({}))) | ||
t.throws(function() { | ||
cache.del([1,2,3]) | ||
}, "del should not accept arrays as keys") | ||
t.end() | ||
@@ -479,11 +458,3 @@ }) | ||
t.throws(function() { | ||
cache.has({ someObjectKey: true }) | ||
}, "has should not accept objects as keys") | ||
t.throws(function() { | ||
cache.has([1,2,3]) | ||
}, "has should not accept arrays as keys") | ||
t.end() | ||
}) |
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
31849
1004