Created
July 27, 2017 09:21
-
-
Save yomotsu/3cb39b526e5a937b0bda82f93dd7fd0f to your computer and use it in GitHub Desktop.
parseUrlQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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