Skip to main content

Expressions

Expressions in Datadance are written using the MozJexl expression language. They are JavaScript-like expressions that are safely evaluated against the input and derived contexts.

Basic operations

TypeOperators
Arithmetic+, -, *, /, %
Comparison==, !=, <, >, <=, >=
Logical&&, ||, !
Ternarycondition ? valueIfTrue : valueIfFalse
String concat+

Context variables

  • input — The original input data object (immutable)
  • derived — The current derived state (mutable, accumulates as transforms execute)
{
"name": "Alice",
"price": 50,
"taxRate": 0.1,
"age": 20
}

Transforms (pipe syntax)

MozJexl uses a pipe | syntax to apply built-in transform functions:

value | transformName(args)
ExpressionResult
"hello" | upper"HELLO"
[1,2,3] | join(', ')"1, 2, 3"
'42' | parseInt42

Transforms can be chained:

input.name | lower | capitalize

Custom operators

Datadance adds two custom binary operators:

  • _= — Case-insensitive string equality: "Hello" _= "hello" returns true
  • === — Strict equality (type + value): "5" === 5 returns false