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

hashlru

Package Overview
Dependencies
Maintainers
1
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 1.0.0 to 1.0.2

43

index.js

@@ -1,7 +0,14 @@

module.exports = function (max) {
var size = 0, cache = {}, _cache = {}
function update (key, value) {
cache[key] = value
size ++
if(size >= max) {
size = 0
_cache = cache
cache = {}
}
}
return {

@@ -11,24 +18,7 @@ get: function (key) {

if(v) return v
if(v = _cache[key]) {
cache[key] = v
size ++
if(size >= max) {
size = 0
_cache = cache
cache = {}
}
}
if(v = _cache[key]) update(key, v)
},
set: function (key, value) {
if(cache[key]) {
cache[key] = value
} else {
cache[key] = value
size ++
if(size >= max) {
size = 0
_cache = cache
cache = {}
}
}
if(cache[key]) cache[key] = value
else update(key, value)
}

@@ -41,1 +31,8 @@ }

{
"name": "hashlru",
"description": "",
"version": "1.0.0",
"description": "simpler faster substitute for LRU",
"version": "1.0.2",
"homepage": "https://github.com/dominictarr/hashlru",

@@ -6,0 +6,0 @@ "repository": {

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