1
0
Fork 0

printTable

This commit is contained in:
Jan Steemann 2013-03-29 01:53:16 +01:00
parent 82cbde7886
commit 0807016cf5
2 changed files with 30 additions and 8 deletions

View File

@ -1136,10 +1136,21 @@
var pad = '...';
var descriptions, matrix, col, what, j, value;
if (columns === undefined) {
what = list[0];
}
else if (Array.isArray(columns)) {
what = { };
columns.forEach(function (col) {
what[col] = null;
});
}
else {
what = columns;
}
j = 0;
descriptions = [ ];
matrix = [ [ ] ];
what = (columns === undefined ? list[0] : columns);
j = 0;
for (col in what) {
if (what.hasOwnProperty(col)) {
@ -1147,7 +1158,7 @@
if (columns && columns.hasOwnProperty(col) && columns[col] > 0) {
fixedLength = columns[col] >= pad.length ? columns[col] : pad.length;
}
descriptions.push({ id: col, name: col, fixedLength: fixedLength, length: fixedLength || 0 });
descriptions.push({ id: col, name: col, fixedLength: fixedLength, length: fixedLength || col.length });
matrix[0][j++] = col;
}
}

View File

@ -1136,10 +1136,21 @@
var pad = '...';
var descriptions, matrix, col, what, j, value;
if (columns === undefined) {
what = list[0];
}
else if (Array.isArray(columns)) {
what = { };
columns.forEach(function (col) {
what[col] = null;
});
}
else {
what = columns;
}
j = 0;
descriptions = [ ];
matrix = [ [ ] ];
what = (columns === undefined ? list[0] : columns);
j = 0;
for (col in what) {
if (what.hasOwnProperty(col)) {
@ -1147,7 +1158,7 @@
if (columns && columns.hasOwnProperty(col) && columns[col] > 0) {
fixedLength = columns[col] >= pad.length ? columns[col] : pad.length;
}
descriptions.push({ id: col, name: col, fixedLength: fixedLength, length: fixedLength || 0 });
descriptions.push({ id: col, name: col, fixedLength: fixedLength, length: fixedLength || col.length });
matrix[0][j++] = col;
}
}