Update IfElseFunction.ts

This commit is contained in:
YISH 2024-02-29 19:34:30 +08:00 committed by GitHub
parent 735425e902
commit a412bcc84e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 10 deletions

View File

@ -101,12 +101,17 @@ class IfElseFunction_Utilities implements INode {
// Some values might be a stringified JSON, parse it
for (const key in inputVars) {
if (typeof inputVars[key] === 'string' && inputVars[key].startsWith('{') && inputVars[key].endsWith('}')) {
try {
inputVars[key] = JSON.parse(inputVars[key])
} catch (e) {
continue
let value = inputVars[key]
if (typeof value === 'string') {
value = handleEscapeCharacters(value, true)
if (value.startsWith('{') && value.endsWith('}')) {
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) {
for (const item in inputVars) {
let value = inputVars[item]
if (typeof value === 'string') {
value = handleEscapeCharacters(value, true)
}
sandbox[`$${item}`] = value
sandbox[`$${item}`] = inputVars[item]
}
}