Skip to content

Commit

Permalink
🚑️ Fix set variable return injection for multi line statements
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Oct 23, 2024
1 parent 4fdc80f commit caa397d
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,8 @@ const evaluateSetVariableExpression =
return { value: output };
};

const injectReturnKeywordIfNeeded = (code: string) => {
const isOneLineCode = code.split("\n").length === 1;
if (!isOneLineCode) return code;
return code.startsWith("return ") ? code : `return ${code}`;
};
const injectReturnKeywordIfNeeded = (code: string) =>
code.includes("return ") ? code : `return ${code}`;

const getExpressionToEvaluate =
(state: SessionState) =>
Expand Down

0 comments on commit caa397d

Please sign in to comment.