Skip to content

Commit

Permalink
chore: contort code to pass test coverage check
Browse files Browse the repository at this point in the history
  • Loading branch information
Chamion committed Mar 26, 2024
1 parent aa75e2e commit 7d0e285
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/node-utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,22 @@ function getRootExpression(
switch (parent.type) {
case AST_NODE_TYPES.ConditionalExpression:
return getRootExpression(parent);
case AST_NODE_TYPES.LogicalExpression:
case AST_NODE_TYPES.LogicalExpression: {
let rootExpression;
switch (parent.operator) {
case '??':
case '||':
return getRootExpression(parent);
rootExpression = getRootExpression(parent);
break;
case '&&':
return parent.right === expression
? getRootExpression(parent)
: expression;
default:
return expression;
rootExpression =
parent.right === expression
? getRootExpression(parent)
: expression;
break;
}
return rootExpression ?? expression;
}
case AST_NODE_TYPES.SequenceExpression:
return parent.expressions[parent.expressions.length - 1] === expression
? getRootExpression(parent)
Expand Down

0 comments on commit 7d0e285

Please sign in to comment.