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 {
const count = this.get(item);
this.map.set(item, count - 1);
const count = this.get(item) - 1;
if (count === 0) {
this.map.delete(item);
} else {
this.map.set(item, count);
}
}
}