Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hashlru

Package Overview
Dependencies
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hashlru - npm Package Compare versions

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 @@ }

}

2

package.json
{
"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)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc