import { proxyStorage } from './proxyStorage' ; param map returns export function serverStorage ( map ? ) { return proxyStorage ( new ServerStorage ( map ) ) ; } class ServerStorage implements Storage { public map : Map < string , string > ; constructor ( map ? ) { this . map = map || new Map < string , string > ( ) ; } public get length ( ) : number { return this . map . size ; } public clear ( ) { this . map . clear ( ) ; } public setItem ( key , value ) { this . map . set ( key , value ) ; } public getItem ( key ) { return this . map . get ( key ) || null ; } public key ( index ) { const values = Array . from ( this . map . keys ( ) ) ; return values [ index ] || null ; } public removeItem ( key ) { this . map . delete ( key ) ; } }