MCPcopy Create free account
hub / github.com/TruthHun/BookStack / buildParams

Function buildParams

static/jquery/1.12.4/jquery.js:10027–10063  ·  view source on GitHub ↗
( prefix, obj, traditional, add )

Source from the content-addressed store, hash-verified

10025 rsubmittable = /^(?:input|select|textarea|keygen)/i;
10026
10027function buildParams( prefix, obj, traditional, add ) {
10028 var name;
10029
10030 if ( jQuery.isArray( obj ) ) {
10031
10032 // Serialize array item.
10033 jQuery.each( obj, function( i, v ) {
10034 if ( traditional || rbracket.test( prefix ) ) {
10035
10036 // Treat each array item as a scalar.
10037 add( prefix, v );
10038
10039 } else {
10040
10041 // Item is non-scalar (array or object), encode its numeric index.
10042 buildParams(
10043 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
10044 v,
10045 traditional,
10046 add
10047 );
10048 }
10049 } );
10050
10051 } else if ( !traditional && jQuery.type( obj ) === "object" ) {
10052
10053 // Serialize object item.
10054 for ( name in obj ) {
10055 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
10056 }
10057
10058 } else {
10059
10060 // Serialize scalar item.
10061 add( prefix, obj );
10062 }
10063}
10064
10065// Serialize an array of form elements or a set of
10066// key/values into a query string

Callers 1

jquery.jsFile · 0.70

Calls 1

addFunction · 0.70

Tested by

no test coverage detected