fix ip counter to delete entry if 0

This commit is contained in:
HF 2021-03-19 00:21:15 +01:00
parent 624a1811bc
commit 72567ffe6a

View File

@ -26,7 +26,11 @@ export default class Counter<T> {
} }
delete(item: T): void { delete(item: T): void {
const count = this.get(item); const count = this.get(item) - 1;
this.map.set(item, count - 1); if (count === 0) {
this.map.delete(item);
} else {
this.map.set(item, count);
}
} }
} }