class LocalStorageMemory { cache : { [ k ] : string ; } = { } ; length = 0 ; getItem ( key ) { if ( key in this . cache ) { return this . cache [ key ] ; } return null ; } setItem ( key , value ) { if ( typeof value === "undefined" ) { this . removeItem ( key ) ; } else { if ( ! this . cache . hasOwnProperty ( key ) ) { this . length ++ ; } this . cache [ key ] = "" + value ; } } removeItem ( key ) { if ( this . cache . hasOwnProperty ( key ) ) { delete this . cache [ key ] ; this . length -- ; } } key ( index ) { return Object . keys ( this . cache ) [ index ] || null ; } clear ( ) { this . cache = { } ; this . length = 0 ; } } export default new LocalStorageMemory ( ) ;