mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-06-14 02:31:02 +00:00
Styles
This commit is contained in:
@@ -13,27 +13,3 @@ export function idGenerator<I extends Id<any>>(): () => I {
|
||||
|
||||
return () => current++ as I;
|
||||
}
|
||||
|
||||
interface HasId<I> {
|
||||
id: I;
|
||||
}
|
||||
|
||||
export class IdSet<I extends Id<any>, T> {
|
||||
private map: Map<I, T> = new Map();
|
||||
|
||||
public add(item: T & HasId<I>) {
|
||||
this.map.set(item.id, item);
|
||||
}
|
||||
|
||||
public remove(item: T & HasId<I>) {
|
||||
this.map.delete(item.id);
|
||||
}
|
||||
|
||||
public entries(): IterableIterator<[I, T]> {
|
||||
return this.map.entries();
|
||||
}
|
||||
|
||||
public values(): IterableIterator<T> {
|
||||
return this.map.values();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user