Standard Library

Operators

Math Operators

+ Addition

expression.Evaluator.run('1 + 1'); // 2

###- Subtraction

expression.Evaluator.run('1 - 1'); // 0

* Multiplication

expression.Evaluator.run('2 * 2'); // 4

###/ Division

expression.Evaluator.run('4 / 2'); // 2

###^ Exponentiation

expression.Evaluator.run('2 ^ 2'); // 4

Data Operators

###( ) Parentheses

Groups expressions together.

expression.Evaluator.run('(1 + 1) * 2'); // 4

###-> Pipe

Read more about piping here.

expression.Evaluator.run('[1, 2, 3] -> MAP($current + 1)'); // (2, 3, 4)

Logical Operators

Equality

= and ==

Evaluates if two values are equal. The = and == operators are equivalent.

expression.Evaluator.run('1 = 1'); // true

Not Equal

<> and !=

Evaluates if two values are not equal. The <> and != operators are equivalent.

expression.Evaluator.run('1 <> 2'); // true

< Less Than

Evaluates if the first value is less than the second value.

expression.Evaluator.run('1 < 2'); // true

> Greater Than

Evaluates if the first value is greater than the second value.

expression.Evaluator.run('2 > 1'); // true

<= Less Than or Equal

Evaluates if the first value is less than or equal to the second value.

expression.Evaluator.run('1 <= 1'); // true

>= Greater Than or Equal

Evaluates if the first value is greater than or equal to the second value.

expression.Evaluator.run('1 >= 1'); // true

&& Logical AND

Evaluates if both values are true.

expression.Evaluator.run('true && true'); // true

|| Logical OR

Evaluates if either value is true.

expression.Evaluator.run('true || false'); // true

String Operators

Concatenation

& and +

Concatenates two strings together. The & and + operators are equivalent.

expression.Evaluator.run('"Hello" & " " & "World"'); // "Hello World"

List and Map Operators

... Spread Operator

When used within a list, it expands the list into its elements.

expression.Evaluator.run('LIST(1, 2, 3, ...LIST(4, 5, 6))'); // (1, 2, 3, 4, 5, 6)
expression.Evaluator.run('[1, 2, 3, ...[4, 5, 6]]'); // (1, 2, 3, 4, 5, 6)

When using within a map it expands the map into its key-value pairs.

expression.Evaluator.run('{ "a": 1, "b": 2, ...{ "c": 3, "d": 4 } }'); // { "a": 1, "b": 2, "c": 3, "d": 4 }
Previous
Comments