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

tiny-lru

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiny-lru - npm Package Compare versions

Comparing version 5.0.7 to 5.1.0

56

lib/tiny-lru.js

@@ -8,3 +8,3 @@ /**

* @link https://github.com/avoidwork/tiny-lru
* @version 5.0.7
* @version 5.1.0
*/

@@ -33,3 +33,26 @@ "use strict";

delete (key, bypass = false) {
return this.remove(key, bypass);
if (bypass === true || this.has(key) === true) {
const item = this.cache[key];
delete this.cache[key];
this.length--;
if (item.next !== empty) {
this.cache[item.next].prev = item.prev;
}
if (item.prev !== empty) {
this.cache[item.prev].next = item.next;
}
if (this.first === key) {
this.first = item.next;
}
if (this.last === key) {
this.last = item.prev;
}
}
return this;
}

@@ -66,27 +89,8 @@

keys () {
return Object.keys(this.cache);
}
remove (key, bypass = false) {
if (bypass === true || this.has(key) === true) {
const item = this.cache[key];
delete this.cache[key];
this.length--;
if (item.next !== empty) {
this.cache[item.next].prev = item.prev;
}
if (item.prev !== empty) {
this.cache[item.prev].next = item.next;
}
if (this.first === key) {
this.first = item.next;
}
if (this.last === key) {
this.last = item.prev;
}
}
return this;
return this.delete(key, bypass);
}

@@ -93,0 +97,0 @@

{
"name": "tiny-lru",
"description": "Tiny LRU cache for Client or Server",
"version": "5.0.7",
"version": "5.1.0",
"homepage": "https://github.com/avoidwork/tiny-lru",

@@ -6,0 +6,0 @@ "author": "Jason Mulligan <jason.mulligan@avoidwork.com>",

@@ -88,2 +88,15 @@ # Tiny LRU

## keys
### Method
Returns an `Array` of cache item keys.
return {Array} Array of keys
**Example**
```javascript
console.log(cache.keys());
```
## max

@@ -131,3 +144,3 @@ ### Property

Removes item from cache
(Deprecated) Removes item from cache

@@ -134,0 +147,0 @@ param {String} key Item key

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