Comparing version 7.0.0 to 7.0.1
@@ -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)}})); |
{ | ||
"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" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
31289
8
0