Skip to content

Commit

Permalink
Fix typeof array condition
Browse files Browse the repository at this point in the history
  • Loading branch information
star-diopside committed Sep 3, 2015
1 parent 65ff266 commit 641b18c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/rails.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,16 @@

function buildParamsInputs(key, value) {
switch (typeof value) {
case 'array':
var result = [];
for (var i = 0, l = value.length; i < l; i++) {
result.push( buildParamsInputs(key === null ? i : key + '[' + i + ']', value[i]) );
}
return result.join('');
case 'object':
var result = [];
for (var i in value) {
result.push( buildParamsInputs(key === null ? i : key + '[' + i + ']', value[i]) );
if ($.isArray(value)) {
for (var i = 0, l = value.length; i < l; i++) {
result.push( buildParamsInputs(key === null ? i : key + '[]', value[i]) );
}
} else {
for (var i in value) {
result.push( buildParamsInputs(key === null ? i : key + '[' + i + ']', value[i]) );
}
}
return result.join('');
default:
Expand Down

0 comments on commit 641b18c

Please sign in to comment.