Skip to content

Commit e059081

Browse files
committed
Fix conversion when table have any row with missing columns
1 parent c81445a commit e059081

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/parse-table.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function parseTable(inputString) {
141141
// each column
142142
data.forEach((row) => {
143143
row.forEach((value, colIndex) => {
144-
if (value === "") {
144+
if (value === null || value === undefined || value === "") {
145145
// Ignore empty values
146146
return;
147147
}
@@ -164,7 +164,7 @@ function parseTable(inputString) {
164164
columnTypes.forEach((type, colIndex) => {
165165
if (type === "numeric") {
166166
const values = data.map((row) => row[colIndex]).filter(value => value !== "");
167-
const allIntegers = values.every((value) => utils.isInt(value));
167+
const allIntegers = values.every((value) => value && utils.isInt(value));
168168
if (allIntegers) {
169169
columnTypes[colIndex] = "integer";
170170
}
@@ -175,7 +175,7 @@ function parseTable(inputString) {
175175
columnTypes.forEach((type, colIndex) => {
176176
if (type === "string") {
177177
const values = data.map((row) => row[colIndex]).filter(value => value !== "");
178-
const allBool = values.every((value) => utils.isBool(value));
178+
const allBool = values.every((value) => value && utils.isBool(value));
179179
if (allBool) {
180180
columnTypes[colIndex] = "boolean";
181181
}

0 commit comments

Comments
 (0)