mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
fix(Google Sheets Node): Incorrect read of 0 and false (#6525)
This commit is contained in:
parent
d3d8522e8f
commit
b6202b5585
|
@ -163,7 +163,7 @@ describe('Test Google Sheets, removeEmptyColumns', () => {
|
|||
expect(result).toBeDefined();
|
||||
expect(result).toEqual([
|
||||
['id', 'col1', 'col3'],
|
||||
['', 'A', 'C'], // TODO:should be [0, 'A', 'C'] ?
|
||||
[0, 'A', 'C'],
|
||||
[1, 'a', 'c'],
|
||||
[2, 'd', 'f'],
|
||||
[3, 'g', 'i'],
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue