import objectFromParamString from './objectFromParamString';
const getUrlState = function getUrlState(opts = {}) {
  const {
    stateMode = 'query'
  } = opts;
  const url = new URL(window.location.href);
  const stateStrings = {
    query: url.search,
    hash: url.hash.slice(1)
  };
  const stateString = stateStrings[stateMode];
  return objectFromParamString(stateString);
};
export default getUrlState;