interface Params { [ key ] : string | null ; room : string | null ; name : string | null ; headphone : headphoneType | null ; speaker : headphoneType | null ; cameraOn : muteType | null ; muteMic : muteType | null ; testBot : string | null ; skipEntrance : string | null ; } export function decodeGetParams ( url ) { const urlObj = new URL ( decodeURI ( url ) ) ; const props = [ 'room' , 'name' , 'headphone' , 'speaker' , 'cameraOn' , 'muteMic' , 'testBot' , 'skipEntrance' ] ; const res = props . reduce ( ( pre , prop ) => { pre [ prop ] = urlObj . searchParams . get ( prop ) ; return pre ; } , { } as Params ) ; res . room = urlObj . pathname . substr ( 1 ) . toLowerCase ( ) . replace ( /[./@]/ , '_' ) + ( res . room ? res . room . toLowerCase ( ) : '' ) ; return res ; } type headphoneType = '' ; type muteType = 'yes' | 'true' | 'no' | 'false' ;