Function find

Returns the first found value that matches predicate or undefined.

Use some if you don't care about the value, just whether it appears. Use filter to get all value(s) that match predicate.

const overThirty = find(people, person => person.age > 30);
  • Type Parameters

    • V

    Parameters

    • map: ReadonlyMap<string, V>

      Map to search

    • predicate: ((v: V) => boolean)

      Function that returns true for a matching value

        • (v): boolean
        • Parameters

          Returns boolean

    Returns undefined | V

    Found value or undefined