Skip to content

Commit

Permalink
fix: better edge case handling
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Jul 21, 2024
1 parent bb2853c commit 08e65f1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/helpers/query/cast$expr.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ function _castExpression(val, schema, strictQuery) {
} else if (val.$ifNull != null) {
val.$ifNull.map(v => _castExpression(v, schema, strictQuery));
} else if (val.$switch != null) {
val.$switch.branches = val.$switch.branches.map(v => _castExpression(v, schema, strictQuery));
val.$switch.default = _castExpression(val.$switch.default, schema, strictQuery);
if (Array.isArray(val.$switch.branches)) {
val.$switch.branches = val.$switch.branches.map(v => _castExpression(v, schema, strictQuery));
}
if ('default' in val.$switch) {
val.$switch.default = _castExpression(val.$switch.default, schema, strictQuery);
}
}

const keys = Object.keys(val);
Expand Down

0 comments on commit 08e65f1

Please sign in to comment.