MCPcopy Index your code
hub / github.com/JsAaron/jQuery / buildParams

Function buildParams

2.0.3/Core2.js:80–106  ·  view source on GitHub ↗
(prefix, obj, traditional, add)

Source from the content-addressed store, hash-verified

78 };
79
80 function buildParams(prefix, obj, traditional, add) {
81 var name;
82
83 if (jQuery.isArray(obj)) {
84 // Serialize array item.
85 jQuery.each(obj, function(i, v) {
86 if (traditional || rbracket.test(prefix)) {
87 // Treat each array item as a scalar.
88 add(prefix, v);
89
90 } else {
91 // Item is non-scalar (array or object), encode its numeric index.
92 buildParams(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add);
93 }
94 });
95
96 } else if (!traditional && jQuery.type(obj) === "object") {
97 // Serialize object item.
98 for (name in obj) {
99 buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
100 }
101
102 } else {
103 // Serialize scalar item.
104 add(prefix, obj);
105 }
106 }
107 jQuery.each(("blur focus focusin focusout load resize scroll unload click dblclick " +
108 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
109 "change select submit keydown keypress keyup error contextmenu").split(" "), function(i, name) {

Callers 1

Core2.jsFile · 0.70

Calls 1

addFunction · 0.70

Tested by

no test coverage detected