const useUrlHandler = () => {
  /*
  *Object to path
  */
  function fnToPath(params){
    let values = Object.values(params)
    let stringValues = values.map(String).join('/')
    return '/' + stringValues
  }
  /*
  *Object to querystring
  */
  function fnToQuery(params){
    return '?'+ Object.keys(params).map(key => key + '=' + params[key]).join('&')
  }
  return { fnToPath, fnToQuery }
}

export default useUrlHandler
