Socket
Socket
Sign inDemoInstall

lru

Package Overview
Dependencies
0
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.1.1

test/lru.js

8

index.js

@@ -9,2 +9,6 @@ var LRU = exports.LRU = function (max) {

LRU.prototype.set = function (key, value) {
key += '';
if (key in this.cache) {
return this.cache[key].value = value;
}
this.cache[key] = {

@@ -28,2 +32,3 @@ next: null

LRU.prototype.get = function (key) {
key += '';
var element = this.cache[key];

@@ -33,2 +38,5 @@ if (!element) {

}
if (this.head === key) {
return element.value;
}
if (element.next) {

@@ -35,0 +43,0 @@ this.cache[element.next].prev = element.prev;

2

package.json
{ "name" : "lru",
"description" : "A simple O(1) LRU cache",
"version" : "0.1.0",
"version" : "0.1.1",
"author" : "Chris O'Hara <cohara87@gmail.com>",

@@ -5,0 +5,0 @@ "main" : "index",

@@ -16,5 +16,5 @@ **A simple LRU cache supporting O(1) set, get and eviction of old keys**

cache.set('foo', bar');
cache.set('foo', 'bar');
cache.get('foo'); //=> bar
```
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc