Created
September 22, 2014 15:53
-
-
Save ih2502mk/16d3a3ac506e413c2a0c to your computer and use it in GitHub Desktop.
Oneliner for getting parameters out of location.search
This file contains 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
location.search | |
.slice(1) | |
.split('&') | |
.map(function(part) {return part.split('=')}) | |
.reduce(function(acc, pair) {acc[pair[0]] = pair[1]; return acc}, {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment