Checks for input before processing it.

This commit is contained in:
Joshi 2020-03-26 09:37:52 -07:00
parent 39d7dc8372
commit 015aa8c637

View File

@ -208,8 +208,11 @@ export const OPERATIONS = [
{
name: 'valueIs',
operation: function (input) {
const values = input[1].split(',');
return values.find((value) => input[0].toString() === _.trim(value.toString()));
if (input[1]) {
const values = input[1].split(',');
return values.find((value) => input[0].toString() === _.trim(value.toString()));
}
return false;
},
text: 'is one of',
appliesTo: ["string", "number"],
@ -221,9 +224,12 @@ export const OPERATIONS = [
{
name: 'valueIsNot',
operation: function (input) {
const values = input[1].split(',');
const found = values.find((value) => input[0].toString() === _.trim(value.toString()));
return !found;
if (input[1]) {
const values = input[1].split(',');
const found = values.find((value) => input[0].toString() === _.trim(value.toString()));
return !found;
}
return false;
},
text: 'is not one of',
appliesTo: ["string", "number"],