Skip to content

Instantly share code, notes, and snippets.

View s-melnikov's full-sized avatar

Sehii Melnykov s-melnikov

View GitHub Profile
function query(obj) {
var str = "";
for (var prop in obj) {
str && (str += "&") || (str = "?");
if (obj.hasOwnProperty(prop)) str += prop + "=" + obj[prop];
}
return str;
}
function params(str) {
var res = {};
(str || location.search).replace(/^\?/, "").split("&").forEach(function(str) {
str = str.split("=");
res[str[0].toLowerCase()] = str[1] || true;
});
return res;
}
@s-melnikov
s-melnikov / cookie.js
Last active August 29, 2015 14:24
cookie get set