Report templatesFunctions
isNotEmpty
Check if an array or object is not empty
Usage
The isNotEmpty
function checks whether an array has elements or an object has properties.
Syntax
{input | isNotEmpty}
Parameters
input
(array or object): The collection to check
Returns
true
if the array has at least one element or object has at least one propertyfalse
if the array is empty, object has no properties, or input is neither array nor object
Examples
Non-empty array
{["item1", "item2"] | isNotEmpty}
// Returns: true
Empty array
{[] | isNotEmpty}
// Returns: false
Object with properties
{{"name": "John", "age": 30} | isNotEmpty}
// Returns: true
Empty object
{{} | isNotEmpty}
// Returns: false
Conditional rendering
{vulnerabilities | isNotEmpty}
// Returns true if vulnerabilities collection has items
With null/undefined
{null | isNotEmpty}
// Returns: false
String input
{"text" | isNotEmpty}
// Returns: false (not an array or object)
Use Cases
- 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
Common Patterns
Show section only if data exists
{#if findings | isNotEmpty}
// Render findings section
{/if}
Display count or empty message
{scope | isNotEmpty ? "Scope defined" : "No scope defined"}