Skip to content

Operators

  1. pipe — Pipeline
  2. or — Logical OR
  3. and — Logical AND
  4. eq / ne / is / instanceof — Equality / Type check
  5. lt / gt / le / ge — Comparison
  6. add / sub — Addition / Subtraction
  7. mul / div / mod — Multiplication / Division / Modulo
  8. Unary: not / neg / typeof / await / delete / new
  9. Postfix: . access / [args] call / as cast
  10. Primary: literals, identifiers, brackets
data pipe filter
data pipe filter pipe map
data pipe transform[extra-arg]
data pipe .method[arg]

Compiles to:

filter(data)
map(filter(data))
transform(data, extraArg)
data.method(arg)
const x be 42
let y be 10
y be 20
a add b -- a + b
a sub b -- a - b
a mul b -- a * b
a div b -- a / b
a mod b -- a % b
neg x -- -x

eq and is are interchangeable. When the right side is a type name (e.g., string, number, null, or a capitalized class name), it becomes a type check. Otherwise, it becomes a strict equality comparison (===).

a eq b -- a === b
a ne b -- a !== b
a lt b -- a < b
a gt b -- a > b
a le b -- a <= b
a ge b -- a >= b
-- eq and is can be used interchangeably
a eq b -- a === b (value comparison)
a is b -- a === b (value comparison)
a eq string -- typeof a === "string" (type check)
a is string -- typeof a === "string" (type check)
a and b -- a && b
a or b -- a || b
not x -- !x

eq and is both work for type checks when followed by a type name.

x is string -- typeof x === "string"
x eq string -- typeof x === "string"
x is null -- x === null
x is MyClass -- x instanceof MyClass
x instanceof Y -- x instanceof Y
typeof x -- typeof x