find_exp

v10.11.0

Return the first object in an array for which the given expression evaluates to true or return nil if no item in the array satisfies the evaluated expression.

const members = [
  { graduation_year: 2013, name: 'Jay' },
  { graduation_year: 2014, name: 'John' },
  { graduation_year: 2014, name: 'Jack' }
]

Input

{{ members | find_exp: "item", "item.graduation_year == 2014" | json }}

Output

{"graduation_year":2014,"name":"John"}