Skip to content

Instantly share code, notes, and snippets.

@TexRx
Forked from TravelingTechGuy/Object2QS.js
Last active August 29, 2015 14:15
Show Gist options
  • Save TexRx/500b572680f52c983387 to your computer and use it in GitHub Desktop.
Save TexRx/500b572680f52c983387 to your computer and use it in GitHub Desktop.
var objectToQueryString = function(obj) {
var qs = _.reduce(obj, function(result, value, key) {
return (!_.isNull(value) && !_.isUndefined(value)) ? (result += key + '=' + value + '&') : result;
}, '').slice(0, -1);
return qs;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment