modality-kit 0.14.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +14 -11
- package/dist/types/lruCache.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5893,46 +5893,49 @@ class WebSocketClient {
|
|
|
5893
5893
|
}
|
|
5894
5894
|
// src/lruCache.ts
|
|
5895
5895
|
class LruCache {
|
|
5896
|
-
|
|
5896
|
+
_values = new Map;
|
|
5897
5897
|
max;
|
|
5898
5898
|
constructor(max = 100) {
|
|
5899
5899
|
this.max = max;
|
|
5900
5900
|
}
|
|
5901
5901
|
has(key) {
|
|
5902
|
-
return this.
|
|
5902
|
+
return this._values.has(key);
|
|
5903
5903
|
}
|
|
5904
5904
|
get(key) {
|
|
5905
|
-
const value = this.
|
|
5905
|
+
const value = this._values.get(key);
|
|
5906
5906
|
if (value) {
|
|
5907
|
-
this.
|
|
5908
|
-
this.
|
|
5907
|
+
this._values.delete(key);
|
|
5908
|
+
this._values.set(key, value);
|
|
5909
5909
|
}
|
|
5910
5910
|
return value;
|
|
5911
5911
|
}
|
|
5912
5912
|
set(key, value) {
|
|
5913
5913
|
if (this.size() >= this.max) {
|
|
5914
5914
|
const itemsToEvictCount = Math.max(1, Math.floor(this.max * 0.25));
|
|
5915
|
-
const keys = this.
|
|
5915
|
+
const keys = this._values.keys();
|
|
5916
5916
|
let count = 0;
|
|
5917
5917
|
while (count < itemsToEvictCount) {
|
|
5918
5918
|
const next = keys.next();
|
|
5919
5919
|
if (next.done) {
|
|
5920
5920
|
break;
|
|
5921
5921
|
}
|
|
5922
|
-
this.
|
|
5922
|
+
this._values.delete(next.value);
|
|
5923
5923
|
count++;
|
|
5924
5924
|
}
|
|
5925
5925
|
}
|
|
5926
|
-
this.
|
|
5926
|
+
this._values.set(key, value);
|
|
5927
5927
|
}
|
|
5928
5928
|
delete(key) {
|
|
5929
|
-
return this.
|
|
5929
|
+
return this._values.delete(key);
|
|
5930
5930
|
}
|
|
5931
5931
|
clear() {
|
|
5932
|
-
this.
|
|
5932
|
+
this._values.clear();
|
|
5933
5933
|
}
|
|
5934
5934
|
size() {
|
|
5935
|
-
return this.
|
|
5935
|
+
return this._values.size;
|
|
5936
|
+
}
|
|
5937
|
+
values() {
|
|
5938
|
+
return this._values.values();
|
|
5936
5939
|
}
|
|
5937
5940
|
}
|
|
5938
5941
|
export {
|
package/dist/types/lruCache.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare class LruCache<T> {
|
|
2
|
-
private
|
|
2
|
+
private _values;
|
|
3
3
|
private max;
|
|
4
4
|
constructor(max?: number);
|
|
5
5
|
has(key: string): boolean;
|
|
@@ -8,4 +8,5 @@ export declare class LruCache<T> {
|
|
|
8
8
|
delete(key: string): boolean;
|
|
9
9
|
clear(): void;
|
|
10
10
|
size(): number;
|
|
11
|
+
values(): IterableIterator<T>;
|
|
11
12
|
}
|
package/package.json
CHANGED