Options
All
  • Public
  • Public/Protected
  • All
Menu

Module promise/tap

Index

References

Functions

References

Renames and re-exports tap

Functions

  • tap<T>(fn: Void1<T>, x: T): Promise<T>
  • tap(fn: Void1<any>): <T>(x: T) => Promise<T>
  • Runs the given promise with the supplied argument. Returns the argument, when promise is resolved.

    example
     var sayX = x => console.log('x is ' + x);
    Promise.resolve(5).then(promiseTap(sayX));
    // logs 'x is 5'

    Type parameters

    • T

    Parameters

    • fn: Void1<T>

      The function to call with x. The return value of fn will be thrown away.

    • x: T

    Returns Promise<T>

    x.

  • Runs the given promise with the supplied argument. Returns the argument, when promise is resolved.

    example
     var sayX = x => console.log('x is ' + x);
    Promise.resolve(5).then(promiseTap(sayX));
    // logs 'x is 5'

    Parameters

    • fn: Void1<any>

      The function to call with x. The return value of fn will be thrown away.

    Returns <T>(x: T) => Promise<T>

    x.

      • <T>(x: T): Promise<T>
      • Type parameters

        • T

        Parameters

        • x: T

        Returns Promise<T>

Generated using TypeDoc