Skip to content

Commit

Permalink
fix: guard against undefined right
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Nov 11, 2021
1 parent 0a7183b commit c02506b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/internalFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ export const internalFilter = <T extends Object>(
highlights,
);

if (!ast.right) {
throw new Error('Unexpected state.');
}

if (ast.operator === 'OR') {
const rightRows = internalFilter(
ast.right,
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type Ast = {
range?: Range,
regex?: boolean,
relationalOperator?: RelationalOperator,
right: Ast,
right?: Ast,
test?: InternalTest,
};

Expand Down

0 comments on commit c02506b

Please sign in to comment.