2
0

🐛 (setVariable) Avoid evaluate code if single variable

This commit is contained in:
Baptiste Arnaud
2023-02-22 12:21:11 +01:00
parent 3967e5f1d0
commit 6339f442bf

View File

@ -37,6 +37,9 @@ export const executeSetVariable = async (
const evaluateSetVariableExpression =
(variables: Variable[]) =>
(str: string): unknown => {
const isSingleVariable =
str.startsWith('{{') && str.endsWith('}}') && str.split('{{').length === 2
if (isSingleVariable) return parseVariables(variables)(str)
const evaluating = parseVariables(variables, { fieldToParse: 'id' })(
str.includes('return ') ? str : `return ${str}`
)