fix: don't throw on haystack not being array

This commit is contained in:
cha0s 2021-01-03 20:24:08 -06:00
parent 18272ceecf
commit d204ed8ac9

View File

@ -39,6 +39,9 @@ export default (latus) => (condition) => {
return true;
case 'contains': {
const haystack = operands[0](context);
if (!Array.isArray(haystack)) {
return false;
}
const needle = operands[1](context);
return -1 !== haystack.indexOf(needle);
}