The isTruthy helper returns true if the input value is truthy according to JavaScript rules (e.g., non-empty strings, non-zero numbers, objects, and arrays).
Evaluate different truthy and falsy values
{{isTruthy record.a}}
{{isTruthy record.b}}
{{isTruthy record.c}}
{{isTruthy record.d}}
{{isTruthy record.e}}
Input:
{
"record": {
"a": 1,
"b": 0,
"c": "hello",
"d": "",
"e": null
}
}
Output:
true false true false false
Conditional rendering example
{{#if (isTruthy record.status)}}
Active
{{else}}
Inactive
{{/if}}
Input:
{ "record": { "status": "enabled" } }
Output:
Active
Tip
-
Follows standard JavaScript truthiness rules.
-
Useful for conditional logic when you need to check if a value exists or is non-empty.
-
Combine with
#ifor logical helpers (#and,#or) to simplify flow control.