From 806af22b44ad3e6a2faeda330fe75d76e209e0fe Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Tue, 7 May 2024 07:29:48 +0100 Subject: [PATCH] Add multi value to != --- .../tools/checkFlowVariable/1.0.0/index.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/FlowPluginsTs/CommunityFlowPlugins/tools/checkFlowVariable/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/tools/checkFlowVariable/1.0.0/index.ts index 21f4a4b..844c6e1 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/tools/checkFlowVariable/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/tools/checkFlowVariable/1.0.0/index.ts @@ -65,9 +65,7 @@ const details = (): IpluginDetails => ({ type: 'text', }, tooltip: `Value of variable to check. - For == condition, you can specify multiple values separated by comma. For example: value1,value2,value3 - If the variable matches any of the values, the condition is true. - `, +You can specify multiple values separated by comma. For example: value1,value2,value3`, }, ], outputs: [ @@ -125,21 +123,21 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => { targetValue = String(targetValue); let outputNumber = 1; + const valuesArr = value.trim().split(','); if (condition === '==') { - const valuesArr = value.trim().split(','); if (valuesArr.includes(targetValue)) { args.jobLog(`Variable ${variable} of value ${targetValue} matches condition ${condition} ${valuesArr}`); outputNumber = 1; } else { - args.jobLog(`Variable ${variable} of value ${targetValue} does not match condition ${condition} ${value}`); + args.jobLog(`Variable ${variable} of value ${targetValue} does not match condition ${condition} ${valuesArr}`); outputNumber = 2; } } else if (condition === '!=') { - if (targetValue !== value) { - args.jobLog(`Variable ${variable} of value ${targetValue} matches condition ${condition} ${value}`); + if (!valuesArr.includes(targetValue)) { + args.jobLog(`Variable ${variable} of value ${targetValue} matches condition ${condition} ${valuesArr}`); outputNumber = 1; } else { - args.jobLog(`Variable ${variable} of value ${targetValue} does not match condition ${condition} ${value}`); + args.jobLog(`Variable ${variable} of value ${targetValue} does not match condition ${condition} ${valuesArr}`); outputNumber = 2; } }