import { TSMap } from 'typescript-map' ; export class StringifySet < T extends { toString ( ) : string ; } > { private map : TSMap < string , T > ; constructor ( ) { this . map = new TSMap ( ) ; } public static of < T > ( items ) { const set = new this < T > ( ) ; set . addAll ( items ) ; return set ; } public add ( item ) { this . map . set ( item . toString ( ) , item ) ; } public addAll ( items ) { items . forEach ( i => this . add ( i ) ) ; } public values ( ) { return this . map . values ( ) ; } public remove ( item ) { this . map . delete ( item . toString ( ) ) ; } }