Skip to content

Commit

Permalink
fix 2 in checking nestTables with boolean value
Browse files Browse the repository at this point in the history
  • Loading branch information
sidorares committed Apr 28, 2014
1 parent ba3ac92 commit 92f3758
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/compile_binary_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function compile(fields, options, config) {
var resultTables = {};
var resultTablesArray = [];

if (typeof options.nestTables == 'boolean') {
if (options.nestTables === true) {
for (i = 0; i < fields.length; i++) {
resultTables[fields[i].table] = 1;
}
Expand All @@ -48,7 +48,7 @@ function compile(fields, options, config) {
if (typeof options.nestTables == 'string') {
tableName = srcEscape(fields[i].table);
lvalue = [' this[', srcEscape(fields[i].table + options.nestTables + fields[i].name), ']'].join('');
} else if (typeof options.nestTables === true) {
} else if (options.nestTables === true) {
tableName = srcEscape(fields[i].table);
lvalue = [' this[', tableName, '][', fieldName, ']'].join('');
} else if (options.rowsAsArray) {
Expand Down
5 changes: 2 additions & 3 deletions lib/compile_text_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function compile(fields, options, config) {
var resultTables = {};
var resultTablesArray = [];

if (typeof options.nestTables == 'boolean') {
if (options.nestTables === true) {
for (i = 0; i < fields.length; i++) {
resultTables[fields[i].table] = 1;
}
Expand All @@ -35,12 +35,11 @@ function compile(fields, options, config) {
var tableName = '';
for (i = 0; i < fields.length; i++) {
fieldName = srcEscape(fields[i].name);
//debug: uncomment to see each column type in a parser source comment
result.push(' // ' + fieldName + ': '+ typeNames[fields[i].columnType]);
if (typeof options.nestTables == 'string') {
tableName = srcEscape(fields[i].table);
lvalue = [' this[', srcEscape(fields[i].table + options.nestTables + fields[i].name), ']'].join('');
} else if (typeof options.nestTables === true) {
} else if (options.nestTables === true) {
tableName = srcEscape(fields[i].table);
lvalue = [' this[', tableName, '][', fieldName, ']'].join('');
} else if (options.rowsAsArray) {
Expand Down

0 comments on commit 92f3758

Please sign in to comment.