Skip to main content

Overview

Logical operators let you combine multiple conditions together. Think of them like building blocks for complex rules.

and

All conditions must be true

or

At least one condition must be true

not

Reverses a condition

Architecture

Logical operators are implemented in the LogicalOperators class: Source Files:
  • Logical operators: src/operators/logical.js
  • Base operator: src/operators/base/BaseOperator.js
  • Unit tests: tests/unit/operators/logical.test.js

Key Features

  • Short-circuit evaluation - Stops checking as soon as result is known
  • Unlimited nesting - Combine operators inside each other
  • Works with any operator - Combine comparison, string, array operators, etc.
  • Clear error messages - Helpful feedback when something goes wrong

and - All Must Be True

All conditions must pass for the rule to pass. Like saying “I need this AND that AND those.”

Syntax

Parameters

array
required
Array of rule conditions (minimum 1 condition)

Returns

boolean - true only if all conditions are true

How It Works

Examples

Common Use Cases

Short-circuit: AND stops checking as soon as it finds a false condition, making it faster.

or - At Least One Must Be True

At least one condition must pass. Like saying “I need this OR that OR those.”

Syntax

Parameters

array
required
Array of rule conditions (minimum 1 condition)

Returns

boolean - true if any condition is true

How It Works

Examples

Common Use Cases

Short-circuit: OR stops checking as soon as it finds a true condition, making it faster.

not - Reverse a Condition

Flips a condition - true becomes false, false becomes true. Like saying “NOT this.”

Syntax

Parameters

object
required
Single rule condition (exactly 1, no more, no less)

Returns

boolean - true if condition is false, false if condition is true

How It Works

Examples

Common Use Cases

NOT takes exactly one condition. Use { neq: [...] } for simple “not equal” checks.

Combining Operators

Mix AND, OR, and NOT to create complex logic:

Complex Examples

Error Handling

Common Errors

Tips for Debugging

Quick Reference

Operator Comparison

Common Patterns

Equality Operators

eq, neq

Numeric Operators

GT, GTE, LT, LTE

Array Operators

in, notIn

String Operators

contains, startsWith, endsWith

Special Operators

isNull, isNotNull, between

All Operators

Complete reference

API Reference

For complete API documentation: