fix(Google Sheets Node): Incorrect read of 0 and false (#6525)

This commit is contained in:
Michael Kret
2023-06-23 14:24:31 +03:00
committed by कारतोफ्फेलस्क्रिप्ट™
parent d3d8522e8f
commit b6202b5585
2 changed files with 7 additions and 3 deletions

View File

@@ -102,7 +102,9 @@ export function trimToFirstEmptyRow(data: SheetRangeData, includesRowNumber = tr
export function removeEmptyRows(data: SheetRangeData, includesRowNumber = true) {
const baseLength = includesRowNumber ? 1 : 0;
const notEmptyRows = data.filter((row) =>
row.slice(baseLength).some((cell) => cell || typeof cell === 'number'),
row
.slice(baseLength)
.some((cell) => cell || typeof cell === 'number' || typeof cell === 'boolean'),
);
if (includesRowNumber) {
notEmptyRows[0][0] = ROW_NUMBER;
@@ -143,7 +145,9 @@ export function removeEmptyColumns(data: SheetRangeData) {
returnData.push(column);
}
}
return (returnData[0] || []).map((_, i) => returnData.map((row) => row[i] || ''));
return (returnData[0] || []).map((_, i) =>
returnData.map((row) => (row[i] === undefined ? '' : row[i])),
);
}
export function prepareSheetData(