-
Notifications
You must be signed in to change notification settings - Fork 1
Built in Expressions Reference
Glossary:
- Bypass result: Returns the last result in the expression-block.
Description: Returns the input expression as a result
Hint: Unsupported
Input: Executed once
Result: Any value
Description: Returns the variable path in the hint.
Hint: Required, the path of the variable.
Input: Ignored
Result: Any value
Description: Sets the input as the value for the variable name given in the hint.
Hint: Required, the path of the variable.
Input: Executed once
Result: Bypass
Description: Sets the input as the value for the variable name given in the hint. The variable is created only for the current block, it does not override variables of outer scope.
Hint: Required, the path of the variable.
Input: Executed once
Result: Bypass
Description: Returns the input if the operand is evaluated as true(following the Javascript evaluation rules for booleans), otherwise it returns the result in the block. The operand can be a path in the hint or the previous result.
Hint: Optional, the path of the variable.
Input: Executed once
Result: If the condition is met returns the input, otherwise it Bypass the result.
Description: Returns the input if the operand is evaluated as false(following the Javascript evaluation rules for booleans). The operand can be a variable name in the hint or the previous result.
Hint: Optional, the path of the variable.
Input: Executed once
Result: If the condition is met returns the input, otherwise it Bypass the result.
Description: Process the input forever or until it founds a loop control expression. Returns an array with the results of every input execution.
Hint: Optional, prefix for Input variable names.
Input: Executed multiple times.
Result: Array
Input Variables: CurrentIndex
Description: Process the input per element in the array in the last result. Returns an array with the results of every input execution.
Hint: Optional, prefix for Input variable names.
Input: Executed multiple times.
Input Variables: CurrentItem, CurrentIndex
Result: Array
Description: Immediately stops the execution of the current or any other iteration. Any result in the current iteration will NOT be added to the loop.
Hint: Unsupported
Input: Ignored
Result: Bypass
Description: Immediately stops the execution of the current iteration. Any result in the current iteration will NOT be added to the loop.
Hint: Unsupported
Input: Ignored
Result: Bypass
Description: When used inside priest JSON code, it executes the input of the root expression. Specially intended for custom expressions.
Hint: Unsupported
Input: Ignored
Result: Any value.
Description: Returns the input, if there is any error it will be saved internally so @catch
or @returnError
work properly.
Hint: Unsupported
Input: Executed once.
Result: Any value. Bypass if any errors occurs.
Description: Returns the input if an error was catch by @try
. Clears the error automatically.
Hint: Optional, prefix for Input variable names.
Input: Executed once.
Result: Any value. Bypass if there is no errors.
Input Variables: CurrentError
Description: Returns the last error in the expression block. if there is no errors it returns undefined
.
Hint: Unsupported
Input: Ignored.
Result: Any value.
Description: Clears the last error in the expression block.
Hint: Unsupported
Input: Ignored.
Result: Bypass.
Description: Raises an error using the input.
Hint: Unsupported
Input: Executed once.
Result: Bypass.
Description: Returns true if all the comparable values are equal, otherwise returns false. A hint with 'strict' can enforce the expression to compare types too, by default this is turned off. If operand doesn't have at least two comparable values it will return undefined.
Hint: Optional, "strict" can enforce type checking.
Input: Executed once.
Result: Boolean value or undefined.
Description: Returns true if all the comparable values are not equal, otherwise returns false. A hint with 'strict' can enforce the expression to compare types too, by default this is turned off. If operand doesn't have at least two comparable values it will return undefined. Ignores any input.
Hint: Optional, "strict" can enforce type checking.
Input: Executed once.
Result: Boolean value or undefined.
Description: Increments the given variable name in the hint by the input. If the operand or the input are not numbers it will assign NaN.
Hint: Required, Variable name.
Input: Executed once.
Result: Bypass.
Description: Decrements the given variable name in the hint by the input. If the operand or the input are not numbers it will assign NaN.
Hint: Required, Variable name.
Input: Executed once.
Result: Bypass.
Due the flexibility of the Javascript object-system, priest behaves in certain ways when a conditional expression needs to compare the values of a given input(mostly known as operand). Internally priest will try to convert anything to an array of comparable values before execute any comparison and it follows some simple rules:
- the comparable values of any array it's the array itself
- the comparable values of null is an empty array
- the comparable values of undefined is an empty array
- the comparable values of an empty object is an empty array
- the comparable values of any object are all the values of the first-level properties
- the comparable values of any boolean is an empty array
- the comparable values of any string are all the chars in the String