Express Sweet API Reference - v3.0.0
    Preparing search index...
    • Finds an object in an array based on the specified field name and value.

      Parameters

      • array: { [key: string]: any }[]

        The array of objects to search.

      • fieldName: string

        The name of the field to search.

      • fieldValue: any

        The value to search for.

      Returns null | object

      The first object in the array that matches the criteria, or null if no match is found.

      {{!-- 
      items is an array of objects: [{id: 123, name: 'Item A'}, {id: 456, name: 'Item B'}]
      This code will output: "Item A"
      --}}
      {{#each items}}
      {{#if (eq id 123)}}
      {{lookup (findObjectInArray ../items 'id' id) 'name'}}
      {{/if}}
      {{/each}}