Skip to content

Instantly share code, notes, and snippets.

@kmaglione
Created May 14, 2015 20:14
Show Gist options
  • Save kmaglione/428d325fc1de711ed0f7 to your computer and use it in GitHub Desktop.
Save kmaglione/428d325fc1de711ed0f7 to your computer and use it in GitHub Desktop.
postArgs: function(data) {
data.toString = function(format) {
return format.replace(/%([^%]+)%/g, function(_, key) {
return this.hasOwnProperty(key) ? this[key] : '';
}.bind(this));
}
var format = "";
for (var key in data) {
if (key !== 'toString') {
format = format + key + "=%" + key + "%&";
}
}
return data.toString(format);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment