class Storage { public set ( key , value ) { if ( typeof value === 'undefined' ) value = '__undefined__' ; localStorage . setItem ( key , JSON . stringify ( value ) ) ; } public get ( key , defaultValue = null ) { const value = localStorage . getItem ( key ) ; if ( value === null ) return defaultValue ; if ( value === '__undefined__' ) return undefined ; return JSON . parse ( value ) ; } public has ( key ) { return localStorage . getItem ( key ) !== null ; } public remove ( key ) { localStorage . removeItem ( key ) ; } } export default new Storage ( ) ;