Skip to content

Bars Specification 0.1.0 — Transform: find_index

Category: list · Since: 0.1.0

Finds the index of the first element matching a predicate.

Returns the index of the first element matching the same predicate as where/find. A soft failure (NoMatch, yielding null) fires when nothing matches.

Input coercion: list

Arguments

Name Type Optional Default
property string no
value string yes

Arity: 1–2

Worked examples

{{ items | find_index: "k" "b" }}

1
{{ items | find_index: "ok" }}

1

Full fixture: transforms/transform-find_index.json