compact

Remove null and empty-string values from a collection.

View Markdown

Syntax

{{ value | compact }}

Usage

  • Whitespace-only strings are empty. The values 0 and false are preserved.
  • For objects, matching properties are removed. Nested collections are preserved.
  • Serialized arrays and objects produced by another filter are recognized automatically.

Examples