Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix #48

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ function parseSheet(sheet, setting) {
let row = sheet.data[i_row];

let parsed_row = parseRow(row, i_row, setting.head);

if (!parsed_row) {
console.log("err null row:", i_row + 1)
continue;
}
if (setting.type === SheetType.MASTER) {

let id_cell = _.find(setting.head, item => {
Expand Down Expand Up @@ -167,6 +170,7 @@ function parseRow(row, rowIndex, head) {
let result = {};
let id;

let isAllNull = true;
for (let index = 0; index < head.length; index++) {
let cell = row[index];

Expand All @@ -182,6 +186,8 @@ function parseRow(row, rowIndex, head) {
continue;
}

isAllNull = false

switch (type) {
case DataType.ID:
id = cell + '';
Expand Down Expand Up @@ -241,7 +247,10 @@ function parseRow(row, rowIndex, head) {
}
}

return result;
if (isAllNull)
return null;
else
return result;
}

/**
Expand Down Expand Up @@ -368,4 +377,4 @@ module.exports = {

return parsed_workbook;
}
};
};