Skip to main content

Overview

State change operators detect changes between evaluations. Requires StatefulRuleEngine or manual _previous context.

changed

Any value change

changedBy

Change by threshold

changedFrom

Changed from value

changedTo

Changed to value

increased

Numeric increase

decreased

Numeric decrease

Requirements

StatefulRuleEngine Required: These operators need previous state. Use StatefulRuleEngine or pass _previous context manually.
Source: src/operators/state.js | Tests: tests/unit/operators/state.test.js

Operators

changed - Any Change

Detects any value change.
Example:

changedBy - Threshold Change

Detects numeric change by minimum amount (absolute value).
Example:

changedFrom - From Specific Value

Detects transition from a specific value.
Example:

changedTo - To Specific Value

Detects transition to a specific value.
Example:

increased - Numeric Increase

Detects any numeric increase.
Example:

decreased - Numeric Decrease

Detects any numeric decrease.
Example:

Common Use Cases

StatefulRuleEngine Usage

Basic Setup

Event System

Batch Evaluation

Manual Previous Context

Without StatefulRuleEngine, pass _previous manually:

Quick Reference

Error Handling

Comparison

eq, neq

Numeric

gt, gte, lt, lte

Logical

and, or, not

Stateful Engine

StatefulRuleEngine guide

All Operators

Complete reference

API Reference