MCPcopy
hub / github.com/requirejs/requirejs / buildParams

Function buildParams

tests/jquery/scripts/jquery-1.7.1.js:7630–7660  ·  view source on GitHub ↗
( prefix, obj, traditional, add )

Source from the content-addressed store, hash-verified

7628});
7629
7630function buildParams( prefix, obj, traditional, add ) {
7631 if ( jQuery.isArray( obj ) ) {
7632 // Serialize array item.
7633 jQuery.each( obj, function( i, v ) {
7634 if ( traditional || rbracket.test( prefix ) ) {
7635 // Treat each array item as a scalar.
7636 add( prefix, v );
7637
7638 } else {
7639 // If array item is non-scalar (array or object), encode its
7640 // numeric index to resolve deserialization ambiguity issues.
7641 // Note that rack (as of 1.0.0) can't currently deserialize
7642 // nested arrays properly, and attempting to do so may cause
7643 // a server error. Possible fixes are to modify rack's
7644 // deserialization algorithm or to provide an option or flag
7645 // to force array serialization to be shallow.
7646 buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
7647 }
7648 });
7649
7650 } else if ( !traditional && obj != null && typeof obj === "object" ) {
7651 // Serialize object item.
7652 for ( var name in obj ) {
7653 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
7654 }
7655
7656 } else {
7657 // Serialize scalar item.
7658 add( prefix, obj );
7659 }
7660}
7661
7662// This is still on the jQuery object... for now
7663// Want to move this to jQuery.ajax some day

Callers 1

jquery-1.7.1.jsFile · 0.85

Calls 1

addFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…