Skip to content

Instantly share code, notes, and snippets.

@yomotsu
Created July 27, 2017 09:21
Show Gist options
  • Save yomotsu/3cb39b526e5a937b0bda82f93dd7fd0f to your computer and use it in GitHub Desktop.
Save yomotsu/3cb39b526e5a937b0bda82f93dd7fd0f to your computer and use it in GitHub Desktop.
parseUrlQuery
function parseUrlQuery() {
const q = location.search.slice( 1 );
return q.split( '&' ).reduce( ( result, item ) => {
const _item = item.split( '=' );
const key = decodeURIComponent( _item[ 0 ] );
const val = decodeURIComponent( _item[ 1 ] );
result[ key ] = val;
return result;
}, {} );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment