mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 23:01:09 +03:00
Update IfElseFunction.ts
This commit is contained in:
@@ -101,12 +101,17 @@ class IfElseFunction_Utilities implements INode {
|
|||||||
|
|
||||||
// Some values might be a stringified JSON, parse it
|
// Some values might be a stringified JSON, parse it
|
||||||
for (const key in inputVars) {
|
for (const key in inputVars) {
|
||||||
if (typeof inputVars[key] === 'string' && inputVars[key].startsWith('{') && inputVars[key].endsWith('}')) {
|
let value = inputVars[key]
|
||||||
try {
|
if (typeof value === 'string') {
|
||||||
inputVars[key] = JSON.parse(inputVars[key])
|
value = handleEscapeCharacters(value, true)
|
||||||
} catch (e) {
|
if (value.startsWith('{') && value.endsWith('}')) {
|
||||||
continue
|
try {
|
||||||
|
value = JSON.parse(value)
|
||||||
|
} catch (e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
inputVars[key] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,11 +121,7 @@ class IfElseFunction_Utilities implements INode {
|
|||||||
|
|
||||||
if (Object.keys(inputVars).length) {
|
if (Object.keys(inputVars).length) {
|
||||||
for (const item in inputVars) {
|
for (const item in inputVars) {
|
||||||
let value = inputVars[item]
|
sandbox[`$${item}`] = inputVars[item]
|
||||||
if (typeof value === 'string') {
|
|
||||||
value = handleEscapeCharacters(value, true)
|
|
||||||
}
|
|
||||||
sandbox[`$${item}`] = value
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user