Articles in this section

isTruthy helper

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).

Usage

{{isTruthy value}}
  • value (required): Any input to evaluate

Examples

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 #if or logical helpers (#and, #or) to simplify flow control.