MCPcopy Create free account
hub / github.com/OpenIntroStat/ims / buildParams

Function buildParams

libs/jquery-3.5.1/jquery-3.5.1.js:8885–8921  ·  view source on GitHub ↗
( prefix, obj, traditional, add )

Source from the content-addressed store, hash-verified

8883 rsubmittable = /^(?:input|select|textarea|keygen)/i;
8884
8885function buildParams( prefix, obj, traditional, add ) {
8886 var name;
8887
8888 if ( Array.isArray( obj ) ) {
8889
8890 // Serialize array item.
8891 jQuery.each( obj, function( i, v ) {
8892 if ( traditional || rbracket.test( prefix ) ) {
8893
8894 // Treat each array item as a scalar.
8895 add( prefix, v );
8896
8897 } else {
8898
8899 // Item is non-scalar (array or object), encode its numeric index.
8900 buildParams(
8901 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
8902 v,
8903 traditional,
8904 add
8905 );
8906 }
8907 } );
8908
8909 } else if ( !traditional && toType( obj ) === "object" ) {
8910
8911 // Serialize object item.
8912 for ( name in obj ) {
8913 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
8914 }
8915
8916 } else {
8917
8918 // Serialize scalar item.
8919 add( prefix, obj );
8920 }
8921}
8922
8923// Serialize an array of form elements or a set of
8924// key/values into a query string

Callers 1

jquery-3.5.1.jsFile · 0.70

Calls 2

toTypeFunction · 0.85
addFunction · 0.70

Tested by

no test coverage detected