• Iterates over an array, applying a provided function to each element, and returns the first defined value returned by the function. If all function calls return undefined, the function itself returns undefined.

    Type Parameters

    • TValue

      The type of elements in the input array.

    • TReturn

      The type of elements that the function can potentially return.

    Parameters

    • items: TValue[]

      The array of items to process.

    • fn: ((item) => undefined | TReturn)

      A function that takes an item of the array and returns a new value or undefined.

        • (item): undefined | TReturn
        • Parameters

          • item: TValue

          Returns undefined | TReturn

    Returns TReturn | undefined

    The first transformed value where the function returns a defined value, or undefined if no such value is found.

Generated using TypeDoc