Comparing version 2.0.0 to 2.1.0
20
index.js
@@ -18,5 +18,14 @@ module.exports = function (max) { | ||
return { | ||
has: function (key) { | ||
return cache[key] !== undefined || _cache[key] !== undefined | ||
}, | ||
remove: function (key) { | ||
if(cache[key] !== undefined) | ||
cache[key] = undefined | ||
if(_cache[key] !== undefined) | ||
_cache[key] = undefined | ||
}, | ||
get: function (key) { | ||
var v = cache[key] | ||
if(v) return v | ||
if(v !== undefined) return v | ||
if(v = _cache[key]) { | ||
@@ -28,3 +37,3 @@ update(key, v) | ||
set: function (key, value) { | ||
if(cache[key]) cache[key] = value | ||
if(cache[key] !== undefined) cache[key] = value | ||
else update(key, value) | ||
@@ -34,1 +43,8 @@ } | ||
} | ||
{ | ||
"name": "hashlru", | ||
"description": "simpler faster substitute for LRU", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"homepage": "https://github.com/dominictarr/hashlru", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -10,2 +10,6 @@ var assert = require('assert') | ||
// has: | ||
assert.equal(lru.has('test'), true) | ||
assert.equal(lru.has('blah'), false) | ||
// update: | ||
@@ -34,1 +38,6 @@ lru.set('test', 'test2') | ||
assert.throws(HLRU) | ||
// remove: | ||
assert.equal(lru.has('test2'), true) | ||
lru.remove('test2') | ||
assert.equal(lru.has('test2'), false) |
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
7954
95