Skip to content

Commit

Permalink
Merge pull request #468 from jvalue/bugfix/table-empty-rows
Browse files Browse the repository at this point in the history
Table numberOfRows increment on no columns
  • Loading branch information
f3l1x98 committed Nov 13, 2023
2 parents 5afa6d3 + 51150f8 commit f014d7a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libs/execution/src/lib/types/io-types/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,20 @@ export class Table implements IOTypeImplementation<IOType.TABLE> {
this.columns.set(name, column);
}

/**
* Tries to add a new row to this table.
* NOTE: This method will only add the row if the table has at least one column!
* @param row data of this row for each column
*/
addRow(row: TableRow): void {
const rowLength = Object.keys(row).length;
assert(
rowLength === this.columns.size,
`Added row has the wrong dimension (expected: ${this.columns.size}, actual: ${rowLength})`,
);
if (rowLength === 0) {
return;
}
assert(
Object.keys(row).every((x) => this.hasColumn(x)),
'Added row does not fit the columns in the table',
Expand Down

0 comments on commit f014d7a

Please sign in to comment.