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