This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function query(obj) { | |
var str = ""; | |
for (var prop in obj) { | |
str && (str += "&") || (str = "?"); | |
if (obj.hasOwnProperty(prop)) str += prop + "=" + obj[prop]; | |
} | |
return str; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
NewerOlder