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 7.0.0 to 7.0.1

CHANGELOG

0

lib/tiny-lru.cjs.js

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ class LRU {

!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t=t||self).tinyLru=i()}(this,(function(){"use strict";class t{constructor(t=0,i=0){this.first=null,this.items={},this.last=null,this.max=t,this.size=0,this.ttl=i}has(t){return t in this.items}clear(){return this.first=null,this.items={},this.last=null,this.size=0,this}delete(t){if(this.has(t)){const i=this.items[t];delete this.items[t],this.size--,null!==i.prev&&(i.prev.next=i.next),null!==i.next&&(i.next.prev=i.prev),this.first===i&&(this.first=i.next),this.last===i&&(this.last=i.prev)}return this}evict(){const t=this.first;return delete this.items[t.key],this.first=t.next,this.first.prev=null,this.size--,this}get(t){let i;if(this.has(t)){const s=this.items[t];this.ttl>0&&s.expiry<=(new Date).getTime()?this.delete(t):(i=s.value,this.set(t,i,!0))}return i}keys(){return Object.keys(this.items)}set(t,i,s=!1){let e;if(s||this.has(t)){if((e=this.items[t]).value=i,this.last!==e){const t=this.last,i=e.next,s=e.prev;this.first===e&&(this.first=e.next),e.next=null,e.prev=this.last,t.next=e,null!==s&&(s.next=i),null!==i&&(i.prev=s)}}else this.max>0&&this.size===this.max&&this.evict(),e=this.items[t]={expiry:this.ttl>0?(new Date).getTime()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:i},1==++this.size?this.first=e:this.last.next=e;return this.last=e,this}}return function(i=1e3,s=0){if(isNaN(i)||i<0)throw new TypeError("Invalid max value");if(isNaN(s)||s<0)throw new TypeError("Invalid ttl value");return new t(i,s)}}));

5

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

@@ -30,2 +30,3 @@ "author": "Jason Mulligan <jason.mulligan@avoidwork.com>",

"benchmark": "node benchmark.js",
"changelog": "git log --no-merges --date=short --tags --format=\"[%cd] %h%d %s - %cn (%ce)\" > CHANGELOG",
"test": "nodeunit test/lru.js",

@@ -36,3 +37,3 @@ "build": "tslib build"

"devDependencies": {
"tslib-cli": "^5.0.17",
"tslib-cli": "^5.0.18",
"nodeunit": "^0.11.3",

@@ -39,0 +40,0 @@ "precise": "^1.1.0"

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