Skip to content

Instantly share code, notes, and snippets.

@shanimal
Last active June 1, 2016 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shanimal/0be546bbdbb164ce1c8e3ba78b590fb1 to your computer and use it in GitHub Desktop.
Save shanimal/0be546bbdbb164ce1c8e3ba78b590fb1 to your computer and use it in GitHub Desktop.
Code
/**
* parseURIData(location.search.substr(1));
* @param search
* @returns {*}
*/
module.exports = function (search) {
var result = {};
if(!search.length){
return result;
}
return search.split('&').reduce(function (e, v) {
var split = v.split('=');
e[split[0]] = decodeURIComponent(split[1]);
return e;
},result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment