Skip to content

Bars Specification 0.1.0 — Transform: find

Category: list · Since: 0.1.0

Finds the first element matching a predicate.

Returns the first element (a struct) matching the same predicate as where: with value, elements whose property string-equals value; with no value, elements whose property is truthy. 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: "k" "b" }}

{"k":"b","n":2}
{{ items | find: "ok" }}

{"ok":true,"id":9}

Full fixture: transforms/transform-find.json