Articles in this section

#not helper

Inverts truthiness and renders its block if the input is falsy. If the input is truthy, the {{else}} block runs.

Usage

{{#not value}}Block if falsey{{else}}Block if truthy{{/not}}
  • value (required): input value to negate

Examples

  1. Check if a field is empty

    {{#not record.empty}}Field is empty{{else}}Field has value{{/not}}
    

    Input:

    {
      "record": {
        "isEnabled": true,
        "empty": "",
        "count": 0
      }
    }
    

    Output:

    Field is empty
    
  2. Check if a count is zero

    {{#not record.count}}No items available{{else}}Items exist{{/not}}
    

    Input:

    { "record": { "count": 0 } }
    

    Output:

    No items available
    
  3. Empty array is truthy

    {{#not record.items}}No items{{else}}Items array exists{{/not}}

    Input:

    { "record": { "items": [] } }

    Output:

    Items array exists

Tip

  • Evaluates based on standard JavaScript truthy/falsy rules (0, "", null, undefined, and false are falsy).

  • Useful for conditionally displaying fallback messages or handling missing data.

  • Combine with other logical helpers (#and, #or) for more complex conditions.

  • Evaluate using standard JavaScript truthiness rules: 0, "", null, undefined, and false are falsy; non-empty strings (including "0" and "false"), non-zero numbers, objects, and arrays (even []) are truthy.