+ arrayKeyMatch = k.match( /^([^[]+)\[(\d*)\]$/ );
+
+ // If arrayParams and this parameter name contains an array index...
+ if ( options.arrayParams && arrayKeyMatch ) {
+ // Remove the index from parameter name
+ k = arrayKeyMatch[ 1 ];
+
+ // Turn the parameter value into an array (throw away anything else)
+ if ( !Array.isArray( q[ k ] ) ) {
+ q[ k ] = [];
+ }
+
+ i = arrayKeyMatch[ 2 ];
+ if ( i === '' ) {
+ // If no explicit index, append at the end
+ i = q[ k ].length;
+ }
+
+ q[ k ][ i ] = v;