Skip to content

Instantly share code, notes, and snippets.

@zapaiamarce
Last active March 21, 2016 05:33
Show Gist options
  • Save zapaiamarce/9e01509093627a6c8cb2 to your computer and use it in GitHub Desktop.
Save zapaiamarce/9e01509093627a6c8cb2 to your computer and use it in GitHub Desktop.
Query string to object vanilla
var query = (function(){
var q = {}; (location.search.slice(1).split('&') || []).forEach(function(i){ var pair=i.split('='); q[pair[0]] = (pair[1]||null) }); return q;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment