export function parseQuery < T > ( queryString ) { const query = { } ; const items = queryString . split ( "&" ) ; for ( let i = 0 ; i < items . length ; i ++ ) { const item = items [ i ] . split ( "=" ) ; const key = decodeURIComponent ( item [ 0 ] ) ; const value = item . length > 1 ? decodeURIComponent ( item [ 1 ] ) : undefined ; query [ key ] = value ; } return query as T ; } export const debounce = < T extends ( ... args : any [ ] ) => unknown > ( func , wait , immediate = false ) : T => { let timeout ; return function ( ... args ) { const context = this ; const later = ( ) => { timeout = undefined ; if ( ! immediate ) { func . apply ( context , args ) ; } } ; const callNow = immediate && ! timeout ; clearTimeout ( timeout ) ; timeout = setTimeout ( later , wait ) ; if ( callNow ) { func . apply ( context , args ) ; } } ; } ;