Skip to content

isNotEmpty

The isNotEmpty function checks whether an array has elements or an object has properties.

{input | isNotEmpty}
  • input (array or object): The collection to check
  • true if the array has at least one element or object has at least one property
  • false if the array is empty, object has no properties, or input is neither array nor object
{["item1", "item2"] | isNotEmpty}
// Returns: true
{[] | isNotEmpty}
// Returns: false
{{"name": "John", "age": 30} | isNotEmpty}
// Returns: true
{{} | isNotEmpty}
// Returns: false
{vulnerabilities | isNotEmpty}
// Returns true if vulnerabilities collection has items
{null | isNotEmpty}
// Returns: false
{"text" | isNotEmpty}
// Returns: false (not an array or object)
  • Conditional rendering of sections based on data presence
  • Validation before processing collections
  • Showing/hiding empty state messages
  • Pre-checks before iteration
  • Data availability checks in templates
{#if findings | isNotEmpty}
// Render findings section
{/if}
{scope | isNotEmpty ? "Scope defined" : "No scope defined"}