MCPcopy
hub / github.com/perkeep/perkeep / buildParams

Function buildParams

app/publisher/jquery.js:8952–8988  ·  view source on GitHub ↗
( prefix, obj, traditional, add )

Source from the content-addressed store, hash-verified

8950 rsubmittable = /^(?:input|select|textarea|keygen)/i;
8951
8952function buildParams( prefix, obj, traditional, add ) {
8953 var name;
8954
8955 if ( jQuery.isArray( obj ) ) {
8956
8957 // Serialize array item.
8958 jQuery.each( obj, function( i, v ) {
8959 if ( traditional || rbracket.test( prefix ) ) {
8960
8961 // Treat each array item as a scalar.
8962 add( prefix, v );
8963
8964 } else {
8965
8966 // Item is non-scalar (array or object), encode its numeric index.
8967 buildParams(
8968 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
8969 v,
8970 traditional,
8971 add
8972 );
8973 }
8974 } );
8975
8976 } else if ( !traditional && jQuery.type( obj ) === "object" ) {
8977
8978 // Serialize object item.
8979 for ( name in obj ) {
8980 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
8981 }
8982
8983 } else {
8984
8985 // Serialize scalar item.
8986 add( prefix, obj );
8987 }
8988}
8989
8990// Serialize an array of form elements or a set of
8991// key/values into a query string

Callers 1

jquery.jsFile · 0.85

Calls 2

addFunction · 0.85
testMethod · 0.45

Tested by

no test coverage detected