Tweakr
    Preparing search index...

    Function tap

    • Invokes the provided function with the given value, then returns the original value.

      Type Parameters

      • T

      Parameters

      • value: T

        The value to pass through the function.

      • fn: (val: T) => void

        Function to be invoked with the value.

      Returns T

      The original value.

      const result = tap(5, x => console.log(x)); // logs 5, returns 5
      

      1.2.0