• Iterates over an array, applying a provided function to each element. If the function returns a defined value, that value is pushed into a result array. This filters out undefined values from the transformation.

    Type Parameters

    • TValue extends any[]

      The type of elements in the input array.

    • TReturn

      The type of elements in the returned array.

    Parameters

    • items: TValue

      The array of items to process.

    • fn: ((item) => TReturn)

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

        • (item): TReturn
        • Parameters

          • item: TValue[number]

          Returns TReturn

    Returns Exclude<TReturn, undefined>[]

    An array of transformed items where the transformation function returned a defined value.

Generated using TypeDoc