Last active
August 29, 2015 14:07
-
-
Save amatiasq/04492888dcffe0b605ed to your computer and use it in GitHub Desktop.
Parse URL search section ('?foo=123&bar=stuff')
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
function getSearch() { | |
return window.location.search | |
.substr(1) // remove the '?' | |
.split('&') | |
.map(function(entry) { | |
return entry | |
.split('=') | |
.map(decodeURIComponent); | |
}); | |
} |
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
function getSearch() { | |
return window.location.search.substr(1).split('&').map(function(a) { return a.split('=').map(decodeURIComponent) }); | |
} |
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
function getSearch() { | |
return _.object(window.location.search | |
.substr(1) // remove the '?' | |
.split('&') | |
.map(function(entry) { | |
return entry | |
.split('=') | |
.map(decodeURIComponent); | |
}); | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment