Skip to content

Commit ff59499

Browse files
committed
FIO-10822: fixed an issue where evaluations donot work if returned variable is in middle of the custom logic or is not 'value'
1 parent f12ce5d commit ff59499

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ProtectedEvaluator.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ export class Evaluator extends DefaultEvaluator {
3131
return baseEvaluate(func, args, ...rest);
3232
}
3333

34+
3435
if (func.indexOf(' return ') === -1) {
35-
func = `result = (function() { value = ${func}; return value; })()`;
36+
const returnedVariable = rest[0] || 'value';
37+
func = `result = (function() { var ${returnedVariable}; ${func}; return ${returnedVariable}; })()`;
3638
}
3739
else {
3840
func = `result = (function() { ${func} })()`;

0 commit comments

Comments
 (0)