Handlebars Helpers
Eq
Compares two values with strict equality during Handlebars substitution. Useful for conditional text, branching output, prompts, and payload shaping.
The eq helper compares two values and returns true when they are strictly equal.
This helper uses JavaScript strict equality (===), so both the value and the type must match.
Uses
- Use with the
ifhelper to render content when a value matches an expected value - Use to compare strings, numbers, booleans, or other values without using comparison operators directly in a template
Usage
Helper name : eq
eg.
{{eq stub.data.customer.type "business"}}
Examples
Example definition:
Action context:
Substituted definition
Strict Equality
Because eq uses strict equality, values with different types do not match.
If stub.data.customer.count is the number 1, this does not match the string "1".
See also: if_eq