Library API
    Preparing search index...

    Function tap

    • Executes a callback with the provided array and returns the array. Useful for side-effects (e.g., logging) in the middle of a function chain.

      Type Parameters

      • T

      Parameters

      • arr: T[]

        The array to tap into

      • fn: (value: T[]) => void

        The callback to execute

      Returns T[]

      The original array

      tap([1, 2, 3], console.log).map(x => x * 2);