Throw when left operand not provided

This commit is contained in:
Wolfsblvt 2024-09-25 20:51:56 +02:00
parent 7abb1751b1
commit 8c87a24e5d

View File

@ -544,6 +544,10 @@ export function parseBooleanOperands(args) {
* @returns {boolean} True if the rule yields true, false otherwise * @returns {boolean} True if the rule yields true, false otherwise
*/ */
export function evalBoolean(rule, a, b) { export function evalBoolean(rule, a, b) {
if (a === undefined) {
throw new Error('Left operand is not provided');
}
// If right-hand side was not provided, whe just check if the left side is truthy // If right-hand side was not provided, whe just check if the left side is truthy
if (b === undefined) { if (b === undefined) {
switch (rule) { switch (rule) {