# Helper Directives
Helper directives provide powerful array manipulation capabilities.
## @map
Transforms array elements by extracting a property or applying a transform.
### Extract Property
```html
```
### With Transform
```html
## @filter
Filters array elements by key/value with optional operator.
### Basic Filter
```html
```
### With Operators
```html
```
### Available Operators
| `eq` | Equal (default) |
| `ne` | Not equal |
| `gt` | Greater than |
| `gte` | Greater than or equal |
| `lt` | Less than |
| `lte` | Less than or equal |
| `contains` | Contains substring |
| `exists` | Key exists |
## @each
Iterates with index and metadata.
```html
{% if item.first %} (first){% endif %}
{% if item.last %} (last){% endif %}
{% endfor %}
```
## @reduce
Reduces array to a single value.
```html
```
## @flatten
Flattens nested arrays.
```html
{{ [[1, 2], [3, 4], [5]] | flatten | join(", ") }}
{# Output: 1, 2, 3, 4, 5 #}
```
## @partition
Splits array into matched and rest.
```html
Inactive: {{ partitioned.rest | length }}
{% for user in partitioned.matched %}
{{ user.name }} (active)
{% endfor %}
```
## Pipeline Examples
### Complex Data Processing
```html
{# Get names of active users, sorted alphabetically #}
{{ users
| filter(key="active", value=true)
| map(prop="name")
| sort
| join(", ")
}}
{# Get average age of adult users #}
{{ users
| filter(key="age", value=18, op="gte")
| map(prop="age")
| avg
}}
{# Get unique tags from all posts #}
{{ posts
| map(prop="tags")
| flatten
| uniq
| sort
| join(", ")
}}
```