MCPcopy Create free account
hub / github.com/sql-js/sql.js / buildParams

Function buildParams

documentation/javascript/application.js:7993–8025  ·  view source on GitHub ↗
( prefix, obj, traditional, add )

Source from the content-addressed store, hash-verified

7991};
7992
7993function buildParams( prefix, obj, traditional, add ) {
7994 var name;
7995
7996 if ( jQuery.isArray( obj ) ) {
7997 // Serialize array item.
7998 jQuery.each( obj, function( i, v ) {
7999 if ( traditional || rbracket.test( prefix ) ) {
8000 // Treat each array item as a scalar.
8001 add( prefix, v );
8002
8003 } else {
8004 // If array item is non-scalar (array or object), encode its
8005 // numeric index to resolve deserialization ambiguity issues.
8006 // Note that rack (as of 1.0.0) can't currently deserialize
8007 // nested arrays properly, and attempting to do so may cause
8008 // a server error. Possible fixes are to modify rack's
8009 // deserialization algorithm or to provide an option or flag
8010 // to force array serialization to be shallow.
8011 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
8012 }
8013 });
8014
8015 } else if ( !traditional && jQuery.type( obj ) === "object" ) {
8016 // Serialize object item.
8017 for ( name in obj ) {
8018 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
8019 }
8020
8021 } else {
8022 // Serialize scalar item.
8023 add( prefix, obj );
8024 }
8025}
8026var // Document location
8027 ajaxLocation,
8028 // Document location segments

Callers 1

application.jsFile · 0.85

Calls 1

addFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…