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 parseQuery(locationSearch) { | |
locationSearch = locationSearch.substring(1); // remove "?" at the beginning | |
var values = locationSearch.split('&'); | |
var queryObj = values.reduce(function (result, item) { | |
var parts = item.split('='); | |
result[decodeURIComponent(parts[0])] = parts[1]; | |
return result; | |
}, {}); | |
return queryObj; | |
} |
NewerOlder