fix if else in workflow

This commit is contained in:
Simon Larsen
2023-05-01 19:03:20 +01:00
parent 0b23f0ef4a
commit ee9ffc442d

View File

@@ -91,12 +91,24 @@ export default class IfElse extends ComponentCode {
},
});
const serialize: Function = (arg: any): any => {
if (typeof arg === 'string') {
return arg.replace(/\n/g, '');
}
return arg;
};
const script: VMScript = new VMScript(
`module.exports = function() {
const input1 = ${(args['input-1'] as string) || ''};
const input1 = ${
serialize(args['input-1'] as string) || ''
};
const input2 = ${(args['input-2'] as string) || ''};
const input2 = ${
serialize(args['input-2'] as string) || ''
};
return input1 ${
(args['operator'] as string) || '=='