Function doAfter

  • doAfter() will create another function that expects a singoe argument which could either be a simple value or a promise, and doAfter will make sure that the given function is executed synchronously if it's a simple value, or asynchronously after the promise resolves.

    Like thenable, but trying to avoid the creation of all the intermediate objects. With our pipe function, it should be easy to use.

    Example

     pipe(
    promiseOrValue,
    doAfter((v) => { do sync or async stuff with v and return the result }),
    doAfter((w) => { do sync or async stuff and return the result }),
    )

    Type Parameters

    • TIn

    • TOut

    Parameters

    • f: ((v: TIn) => TOut | Promise<TOut>)
        • (v: TIn): TOut | Promise<TOut>
        • Parameters

          • v: TIn

          Returns TOut | Promise<TOut>

    Returns ((x: TIn | Promise<TIn>) => TOut | Promise<TOut>)

      • (x: TIn | Promise<TIn>): TOut | Promise<TOut>
      • Parameters

        • x: TIn | Promise<TIn>

        Returns TOut | Promise<TOut>

Generated using TypeDoc