license export function parseQuery ( qstr ) { const query = { } ; const a = ( qstr [ 0 ] === "?" ? qstr . substr ( 1 ) : qstr ) . split ( "&" ) ; for ( const item of a ) { if ( ! item ) { continue ; } const b = item . split ( "=" ) ; query [ decodeURIComponent ( b [ 0 ] ) ] = decodeURIComponent ( b [ 1 ] || "" ) ; } return query ; } export function toQueryString ( obj ) { const parts = [ ] ; for ( const i of Object . keys ( obj ) ) { if ( obj [ i ] !== undefined ) { parts . push ( `${ encodeURIComponent ( i ) }=${ encodeURIComponent ( obj [ i ] ) }` ) ; } } return parts . join ( "&" ) . replace ( /%2F/g , "/" ) ; }