Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check against multiple values for == #624

Merged
merged 5 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var details = function () { return ({
inputUI: {
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: [
Expand Down Expand Up @@ -99,23 +99,24 @@ var plugin = function (args) {
}
targetValue = String(targetValue);
var outputNumber = 1;
var valuesArr = value.trim().split(',');
if (condition === '==') {
if (targetValue === value) {
args.jobLog("Variable ".concat(variable, " of value ").concat(targetValue, " matches condition ").concat(condition, " ").concat(value));
if (valuesArr.includes(targetValue)) {
args.jobLog("Variable ".concat(variable, " of value ").concat(targetValue, " matches condition ").concat(condition, " ").concat(valuesArr));
outputNumber = 1;
}
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;
}
}
else if (condition === '!=') {
if (targetValue !== value) {
args.jobLog("Variable ".concat(variable, " of value ").concat(targetValue, " matches condition ").concat(condition, " ").concat(value));
if (!valuesArr.includes(targetValue)) {
args.jobLog("Variable ".concat(variable, " of value ").concat(targetValue, " matches condition ").concat(condition, " ").concat(valuesArr));
outputNumber = 1;
}
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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ const details = (): IpluginDetails => ({
inputUI: {
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: [
Expand Down Expand Up @@ -122,20 +123,21 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
targetValue = String(targetValue);
let outputNumber = 1;

const valuesArr = value.trim().split(',');
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;
}
} 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;
}
}
Expand Down