Skip to content

Instantly share code, notes, and snippets.

@builtbylane
Forked from tarmann/gist:5618580
Created July 23, 2014 18:21
Show Gist options
  • Save builtbylane/f20409c1d21fb9d9f853 to your computer and use it in GitHub Desktop.
Save builtbylane/f20409c1d21fb9d9f853 to your computer and use it in GitHub Desktop.
_.mixin({
serialize: function (obj) {
var urlParams = _.map(obj, function (val, key) {
var value = (_.isObject(val)) ? JSON.stringify(val) : String(val);
return String(key) + '=' + value;
});
return urlParams.join('&');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment