Skip to content

Instantly share code, notes, and snippets.

@shankie-codes
Last active August 29, 2015 14:16
Show Gist options
  • Save shankie-codes/ec03354802c0b4aea9b2 to your computer and use it in GitHub Desktop.
Save shankie-codes/ec03354802c0b4aea9b2 to your computer and use it in GitHub Desktop.
Query Parameters - extend String prototype
// Get the query params from a string
String.prototype.getQueryParameters = function(){
return this.replace(/^.*(\?)/,'').split("&").map(function(n){return n = n.split("="),this[n[0]] = n[1],this;}.bind({}))[0];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment