Skip to content

Instantly share code, notes, and snippets.

View jaf0's full-sized avatar

Daniel Weigh jaf0

View GitHub Profile
@jaf0
jaf0 / qs.js
Created August 1, 2014 15:32 — forked from jonmaim/qs.js
/* Converts an object into a key/value par with an optional prefix. Used for converting objects to a query string */
var qs = function(obj, prefix){
var str = [];
for (var p in obj) {
var k = prefix ? prefix + "[" + p + "]" : p,
v = obj[p];
str.push(angular.isObject(v) ? qs(v, k) : (k) + "=" + encodeURIComponent(v));
}
return str.join("&");
}