Operators

eq

{{eq value1 value2}}
Evaluates to true if value1 is equal to value2.
Arguments
Name
Description
Type
Required
value1
A static value or a variable path
String
Number
Boolean
value2
A static value or a variable path
String
Number
Boolean
Returns
Example
Template
Data
Result
{{#if ($eq category "sports") }}Category is sports{{/if}}
{
"category":"sports"
}
Category is sports

ne

{{ne value1 value2}}
Evaluates to true if value1 is not equal to value2.
Arguments
Name
Description
Type
Required
value1
A static value or a variable path
String
Number
Boolean
value2
A static value or a variable path
String
Number
Boolean
Returns
Example
Template
Data
Result
{{#if ($ne category "sports") }}Category is not sports{{/if}}
{
"category":"sports"
}
This is a sports category

gt

{{gt number1 number2}}
Evaluates to true if number1 is greater than the number2.
Arguments
Name
Description
Type
Required
number1
A static value or a variable path
Number
number2
A static value or a variable path
Number
Returns
Example
Template
Data
Result
{{#if ($gt grand_total 1500) }}Grand total is greater than 1500{{/if}}
{
"grand_total": 1600
}
Grand total is greater than 1500

lt

{{lt number1 number2}}
Evaluates to true if number1 is less than number2.
Arguments
Name
Description
Type
Required
number1
A static value or a variable path
Number
number2
A static value or a variable path
Number
Returns
Example
Template
Data
Result
{{#if ($lt score 50) }}Score is less than 50{{/if}}
{
"score": 25
}
Score is less than 50

gte

{{gte number1 number2}}
Evaluates to true if number1 is greater than or equal to number2.
Arguments
Name
Description
Type
Required
number1
A static value or a variable path
Number
number2
A static value or a variable path
Number
Returns
Example
Template
Data
Result
{{#if ($gte score 50) }}Score is greater than or equal to 50{{/if}}
{
"score": 50
}
Score is greater than or equal to 50

lte

{{lte number1 number2}}
Evaluates to true if number1 is less than or equal to number2.
Arguments
Name
Description
Type
Required
number1
A static value or a variable path
Number
number2
A static value or a variable path
Number
Returns
Example
Template
Data
Result
{{#if ($lte score 50) }}Score is less than or equal to 50{{/if}}
{
"score":50
}
Content to display for sports

isNull

{{isNull value}}
Evaluates to true if value is null.
Arguments
Name
Description
Type
Required
value
A static value or a variable path
Any
Returns
Example
Template
Data
Result
{{#if ($isNull category) }}Category is null{{/if}}
{
"category": null
}
Category is null

isNotNull

{{isNotNull value}}
Evaluates to true if value is not null.
Arguments
Name
Description
Type
Required
value
A static value or a variable path
Any
Returns
Example
Template
Data
Result
{{#if ($isNotNull category) }}Category is not null{{/if}}
{
"category": "sports"
}
Category is

isNil

{{isNil value}}
Evaluates to true if value is null or undefined .
Arguments
Name
Description
Type
Required
value
A static value or a variable path
Any
Returns
Example
Template
Data
Result
{{#if (isNil category) }}Category is nil{{/if}}
{
"category":null
}
Category is nil

isNotNil

{{isNotNil value}}
Evaluates to true if value is not null or undefined.
Arguments
Name
Description
Type
Required
value
A static value or a variable path
Any
Returns
Example
Template
Data
Result
{{#if (isNotNil category) }}Category is not nil{{/if}}
{
"category":"sports"
}
Category is not nil

isIn

{{isIn value array}}
Evaluates to true if value is in array.
Arguments
Name
Description
Type
Required
value
A static value or a variable path
String
Number
Boolean
array
Array of values to check for value
String Array
Number Array
Boolean Array
Returns
Example
Template
Data
Result
{{#if (isIn "sports" categories) }}Sports is in categories{{/if}}
{
"categories":[
"sports",
"entertainment",
"news"
]
}
Sports is in categories

isNotIn

{{isNotIn value array}}
Evaluates to true if value is not in array.
Arguments
Name
Description
Type
Required
value
A static value or a variable path
String
Number
Boolean
array
Array of values to check for value
String Array
Number Array
Boolean Array
Returns
Example
Template
Data
Result
{{#if (isNotIn "sports" categories)}}Sports is not in categories{{/if}}
{
"categories":[
"entertainment",
"weather",
"news"
]
}
Sports is not in categories

startsWith

{{startsWith string1 string2}}
Evaluates to true if string1 starts with string2.
Arguments
Name
Description
Type
Required
string1
A static value or a variable path to check for string2
String
string2
A static value or a variable path to check for in string1
String
Returns
Example
Template
Data
Result
{{#if (startsWith movie "Bourne") }}Movie starts with Bourne{{/if}}
{
"movie":"Bourne Identity"
}
Movie starts with Bourne

endsWith

{{endsWith string1 string2}}
Evaluates to true if string1 ends with string2.
Arguments
Name
Description
Type
Required
string1
A static value or a variable path to check for string2
String
string2
A static value or a variable path to check for in string1
String
Returns
Example
Template
Data
Result
{{#if (endsWith movie "Story") }}Movie ends with Story{{/if}}
{
"movie":"Toy Story"
}
Movie ends with Story

contains

{{contains string1 string2}}
Evaluates to true if string1 exists in string2.
Arguments
Name
Description
Type
Required
string1
A static value or a variable path to check for string2
String
string2
A static value or a variable path to check for in string1
String
Returns
Example
Template
Data
Result
{{#if (contains movie "Bronx") }}Movie contains Bronx{{/if}}
{
"movie":"A Bronx Tale"
}
Movie contains Bronx

doesNotContain

{{doesNotContain string1 string2}}
Evaluates to true if string1 does not exist in string2.
Arguments
Name
Description
Type
Required
string1
A static value or a variable path to check for string2
String
string2
A static value or a variable path to check for in string1
String
Returns
Example
Template
Data
Result
{{#if (doesNotContian movie "Batman") }}Movie does not contain Batman{{/if}}
{
"movie":"The Dark Knight"
}
Movie does not contain Batman

isEmpty

{{isEmpty path}}
Evaluates to true if the value of the variable path is undefined or not included in the data set.
Arguments
Name
Description
Type
Required
path
A path to a variable to check for a value
Any
Returns
Example
Template
Data
Result
{{#if (isEmpty category )}}Category is empty{{/if}}
{
"name":"soccer"
}
Category is empty

isNotEmpty

{{isNotEmpty value}}
Evaluates to true if value is undefined or not included in the data set.
Arguments
Name
Description
Type
Required
path
A path to a variable to check for a value
Any
Returns
Example
Template
Data
Result
{{#if (isNotEmpty category) }}Category is not empty{{/if}}
{
"category":"sports"
}
Category is not empty

matches

{{matches string expression}}
Returns true if string matches a regular expression.
Arguments
Name
Description
Type
Required
string
A static value or a variable path to evaluate the regular expression against
String
expression
Regular expression to evaluate
String
Returns
Example
Template
Data
Result
{{#if (matches category "^spo.*") }}Category matches regular expression{{/if}}
{
"category":"sports"
}
Category matches regular expression
Copy link
On this page
eq
ne
gt
lt
gte
lte
isNull
isNotNull
isNil
isNotNil
isIn
isNotIn
startsWith
endsWith
contains
doesNotContain
isEmpty
isNotEmpty
matches