Skip to main content

Overview

Rule Helpers provide a fluent API to build rules programmatically instead of writing JSON.

Comparison Operators

eq()

neq()


Numeric Operators

gt(), gte(), lt(), lte()


Logical Operators

and()

Example:

or()

not()


String Operators

contains()

startsWith()

endsWith()

regex()


Array Operators

in()

notIn()


Special Operators

between()

isNull()

isNotNull()


State Operators

changed()

changedBy()

changedFrom(), changedTo()

increased(), decreased()


Field Comparison

Compare two fields:

Validation Helpers

email()

required()

ageRange()

isTrue(), isFalse()


Complete Example


Comparison: JSON vs Helpers


TypeScript

Basic Usage

Typed Path Autocomplete v1.0.7+

Get IDE autocomplete for object paths by passing a type parameter:
How it works: The generic type T enables TypeScript to infer all valid paths in your object structure and provide autocomplete suggestions.

Type-Safe Operators

Numeric operators only accept numeric paths:

Dynamic Array Lookup

Use string paths to reference arrays in your context:

Backward Compatibility

Untyped usage works exactly as before:

RuleEngine API

Engine API reference

Operators

All available operators

Examples

Practical examples

Quick Start

Get started guide