Awee

find

Find returns the first element in a slice or map where a field equals the given value.

Find returns the first element in a slice or map where a field equals the given value. Returns a non-fatal error when not found, allowing the default modifier to handle it.

Input

array map

Parameters

#TypeRequired
0stringyes
1anyyes

Returns

map

Examples

{{ users | find:'id',42 }}
{{ items | find:'slug','my-item' | default:{} }}

How is this guide?

On this page