export interface IDictionary < K , V > { getKeys ( ) : K [ ] ; getValues ( ) : V [ ] ; get ( key ) : V ; has ( key ) : boolean ; put ( key , val ) : void ; remove ( key ) : void ; clear ( ) : void ; } export class Dictionary < K extends string , V > implements IDictionary < K , V > { private readonly internalDict : any ; constructor ( ) { this . internalDict = { } ; } public getKeys ( ) { return Object . keys ( this . internalDict ) ; } public getValues ( ) { return Object . values ( this . internalDict ) ; } * [ Symbol . iterator ] ( ) { for ( let i of this . internalDict ) { yield i ; } } public dump ( ) { return this . internalDict ; } public get ( key ) { return this . internalDict [ key ] ; } public has ( key ) { return this . internalDict [ key ] != null ; } public put ( key , val ) { this . internalDict [ key ] = val ; } public remove ( key ) { delete this . internalDict [ key ] ; } public clear ( ) { for ( var key in this . internalDict ) { delete this . internalDict [ key ] ; } } }