Merge pull request #624 from HaveAGitGat/check_flow

Check against multiple values for ==
make-only-subtitle-default
HaveAGitGat 2 years ago committed by GitHub
commit c19dd11d4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -47,7 +47,7 @@ var details = function () { return ({
inputUI: { inputUI: {
type: 'text', type: 'text',
}, },
tooltip: 'Value of variable to check', tooltip: "Value of variable to check. \nYou can specify multiple values separated by comma. For example: value1,value2,value3",
}, },
], ],
outputs: [ outputs: [
@ -99,23 +99,24 @@ var plugin = function (args) {
} }
targetValue = String(targetValue); targetValue = String(targetValue);
var outputNumber = 1; var outputNumber = 1;
var valuesArr = value.trim().split(',');
if (condition === '==') { if (condition === '==') {
if (targetValue === value) { if (valuesArr.includes(targetValue)) {
args.jobLog("Variable ".concat(variable, " of value ").concat(targetValue, " matches condition ").concat(condition, " ").concat(value)); args.jobLog("Variable ".concat(variable, " of value ").concat(targetValue, " matches condition ").concat(condition, " ").concat(valuesArr));
outputNumber = 1; outputNumber = 1;
} }
else { else {
args.jobLog("Variable ".concat(variable, " of value ").concat(targetValue, " does not match condition ").concat(condition, " ").concat(value)); args.jobLog("Variable ".concat(variable, " of value ").concat(targetValue, " does not match condition ").concat(condition, " ").concat(valuesArr));
outputNumber = 2; outputNumber = 2;
} }
} }
else if (condition === '!=') { else if (condition === '!=') {
if (targetValue !== value) { if (!valuesArr.includes(targetValue)) {
args.jobLog("Variable ".concat(variable, " of value ").concat(targetValue, " matches condition ").concat(condition, " ").concat(value)); args.jobLog("Variable ".concat(variable, " of value ").concat(targetValue, " matches condition ").concat(condition, " ").concat(valuesArr));
outputNumber = 1; outputNumber = 1;
} }
else { else {
args.jobLog("Variable ".concat(variable, " of value ").concat(targetValue, " does not match condition ").concat(condition, " ").concat(value)); args.jobLog("Variable ".concat(variable, " of value ").concat(targetValue, " does not match condition ").concat(condition, " ").concat(valuesArr));
outputNumber = 2; outputNumber = 2;
} }
} }

@ -64,7 +64,8 @@ const details = (): IpluginDetails => ({
inputUI: { inputUI: {
type: 'text', type: 'text',
}, },
tooltip: 'Value of variable to check', tooltip: `Value of variable to check.
You can specify multiple values separated by comma. For example: value1,value2,value3`,
}, },
], ],
outputs: [ outputs: [
@ -122,20 +123,21 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
targetValue = String(targetValue); targetValue = String(targetValue);
let outputNumber = 1; let outputNumber = 1;
const valuesArr = value.trim().split(',');
if (condition === '==') { if (condition === '==') {
if (targetValue === value) { if (valuesArr.includes(targetValue)) {
args.jobLog(`Variable ${variable} of value ${targetValue} matches condition ${condition} ${value}`); args.jobLog(`Variable ${variable} of value ${targetValue} matches condition ${condition} ${valuesArr}`);
outputNumber = 1; outputNumber = 1;
} else { } 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; outputNumber = 2;
} }
} else if (condition === '!=') { } else if (condition === '!=') {
if (targetValue !== value) { if (!valuesArr.includes(targetValue)) {
args.jobLog(`Variable ${variable} of value ${targetValue} matches condition ${condition} ${value}`); args.jobLog(`Variable ${variable} of value ${targetValue} matches condition ${condition} ${valuesArr}`);
outputNumber = 1; outputNumber = 1;
} else { } 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; outputNumber = 2;
} }
} }

Loading…
Cancel
Save