Enter a search term above to see results...
On This Page
Logical Helpers
Logical helpers provide utilities for conditional checks and logical operations in templates.
Functions
isEmpty
Checks if a value is empty.
Note: empty includes falsey values like
false
,0
undefined
etc.
Template Syntax
Parameters
Name | Type | Description |
---|---|---|
a | any | The value to check |
Returns
boolean
- true
if the value is empty, false
otherwise.
Example
exists
Checks if a value is not empty.
Note: the same conditions as
isEmpty
apply, all falsey values will returnfalse
Template Syntax
Parameters
Name | Type | Description |
---|---|---|
a | any | The value to check |
Returns
boolean
- true
if the value is not empty, false
otherwise.
Example
hasAny
Checks if an array has any elements.
Template Syntax
Parameters
Name | Type | Description |
---|---|---|
a | array | The array to check |
Returns
boolean
- true
if the array has elements, false
otherwise.
Example
both
Checks if both a and b are truthy.
Template Syntax
Parameters
Name | Type | Description |
---|---|---|
a | any | First value to check |
b | any | Second value to check |
Returns
boolean
- true
if both values are truthy, false
otherwise.
Example
either
Checks if either a or b is truthy.
Template Syntax
Parameters
Name | Type | Description |
---|---|---|
a | any | First value to check |
b | any | Second value to check |
Returns
boolean
- true
if either value is truthy, false
otherwise.
Example
maybe
Returns trueExpr if expr is truthy, falseExpr otherwise.
Template Syntax
Parameters
Name | Type | Description |
---|---|---|
expr | any | The expression to evaluate |
trueExpr | any | Value to return if expr is truthy |
falseExpr | any | Value to return if expr is falsy |
Returns
The value of trueExpr
if expr
is truthy, falseExpr
otherwise.