@libp2p/tracked-map
Advanced tools
Comparing version 3.0.2 to 3.0.3
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PTrackedMap = factory()}(typeof self !== 'undefined' ? self : this, function () { | ||
"use strict";var Libp2PTrackedMap=(()=>{var i=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var a=(r,e)=>{for(var t in e)i(r,t,{get:e[t],enumerable:!0})},m=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of o(e))!u.call(r,n)&&n!==t&&i(r,n,{get:()=>e[n],enumerable:!(s=p(e,n))||s.enumerable});return r};var d=r=>m(i({},"__esModule",{value:!0}),r);var h={};a(h,{trackedMap:()=>l});var c=class extends Map{constructor(e){super();let{name:t,metrics:s}=e;this.metric=s.registerMetric(t),this.updateComponentMetric()}set(e,t){return super.set(e,t),this.updateComponentMetric(),this}delete(e){let t=super.delete(e);return this.updateComponentMetric(),t}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}};function l(r){let{name:e,metrics:t}=r,s;return t!=null?s=new c({name:e,metrics:t}):s=new Map,s}return d(h);})(); | ||
"use strict";var Libp2PTrackedMap=(()=>{var i=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var a=(r,e)=>{for(var t in e)i(r,t,{get:e[t],enumerable:!0})},m=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of o(e))!u.call(r,n)&&n!==t&&i(r,n,{get:()=>e[n],enumerable:!(s=p(e,n))||s.enumerable});return r};var d=r=>m(i({},"__esModule",{value:!0}),r);var h={};a(h,{trackedMap:()=>l});var c=class extends Map{metric;constructor(e){super();let{name:t,metrics:s}=e;this.metric=s.registerMetric(t),this.updateComponentMetric()}set(e,t){return super.set(e,t),this.updateComponentMetric(),this}delete(e){let t=super.delete(e);return this.updateComponentMetric(),t}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}};function l(r){let{name:e,metrics:t}=r,s;return t!=null?s=new c({name:e,metrics:t}):s=new Map,s}return d(h);})(); | ||
return Libp2PTrackedMap})); |
class TrackedMap extends Map { | ||
metric; | ||
constructor(init) { | ||
@@ -3,0 +4,0 @@ super(); |
{ | ||
"name": "@libp2p/tracked-map", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Allows tracking of statistics while libp2p is running", | ||
@@ -145,3 +145,4 @@ "license": "Apache-2.0 OR MIT", | ||
"devDependencies": { | ||
"aegir": "^37.0.7", | ||
"@types/sinon": "^10.0.15", | ||
"aegir": "^39.0.10", | ||
"sinon": "^15.0.1", | ||
@@ -148,0 +149,0 @@ "sinon-ts": "^1.0.0" |
@@ -20,3 +20,3 @@ import type { Metric, Metrics } from '@libp2p/interface-metrics' | ||
set (key: K, value: V) { | ||
set (key: K, value: V): this { | ||
super.set(key, value) | ||
@@ -27,3 +27,3 @@ this.updateComponentMetric() | ||
delete (key: K) { | ||
delete (key: K): boolean { | ||
const deleted = super.delete(key) | ||
@@ -34,3 +34,3 @@ this.updateComponentMetric() | ||
clear () { | ||
clear (): void { | ||
super.clear() | ||
@@ -40,3 +40,3 @@ this.updateComponentMetric() | ||
private updateComponentMetric () { | ||
private updateComponentMetric (): void { | ||
this.metric.update(this.size) | ||
@@ -43,0 +43,0 @@ } |
Sorry, the diff of this file is not supported yet
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
11552
114
4