Skip to content

Commit

Permalink
fix(json-expression): 🐛 evaluate prop expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Jun 17, 2024
1 parent 4edfa28 commit 9eb2035
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/json-expression/operators/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const objectOperators: types.OperatorDefinition<any>[] = [
validateSetOperandCount(length);
const doc = util.asObj(ctx.eval(expr[i++], ctx)) as Record<string, unknown>;
while (i < length) {
const prop = util.str(expr[i++]) as string;
const prop = util.str(ctx.eval(expr[i++], ctx)) as string;
if (prop === '__proto__') throw new Error('PROTO_KEY');
const value = ctx.eval(expr[i++], ctx);
doc[prop] = value;
Expand Down Expand Up @@ -143,7 +143,7 @@ export const objectOperators: types.OperatorDefinition<any>[] = [
validateDelOperandCount(length);
const doc = util.asObj(ctx.eval(expr[i++], ctx)) as Record<string, unknown>;
while (i < length) {
const prop = util.str(expr[i++]) as string;
const prop = util.str(ctx.eval(expr[i++], ctx)) as string;
delete doc[prop];
}
return doc;
Expand Down

0 comments on commit 9eb2035

Please sign in to comment.