Function mergeFunctions

  • Merges two functions by calling one after another.

    Optionally merges function call results.

    Type Parameters

    • TArgs extends unknown[]

      Function parameter types as tuple.

    • TReturn

      A type of function result.

    • TThis

      A type if this object expected by function.

    Parameters

    • first: ((this, ...args) => TReturn)

      The first function to call.

        • (this, ...args): TReturn
        • Parameters

          • this: TThis
          • Rest ...args: TArgs

          Returns TReturn

    • second: undefined | ((this, ...args) => TReturn)

      The second function to call.

    • merge: ((first, second) => TReturn)

      Optional function call results merger. Accepts two function results as arguments and returns the final result. When omitted the first function call result is ignored and the second function's call result is returned.

        • (first, second): TReturn
        • Parameters

          • first: TReturn
          • second: TReturn

          Returns TReturn

    Returns ((this, ...args) => TReturn)

    A function that calls both of the given ones and merges their results. If one of the functions is absent, then just returns another one. If both are absent, then returns undefined.

      • (this, ...args): TReturn
      • Parameters

        • this: TThis
        • Rest ...args: TArgs

        Returns TReturn

  • Type Parameters

    • TArgs extends unknown[]

    • TReturn

    • TThis

    Parameters

    • first: undefined | ((this, ...args) => TReturn)
    • second: ((this, ...args) => TReturn)
        • (this, ...args): TReturn
        • Parameters

          • this: TThis
          • Rest ...args: TArgs

          Returns TReturn

    • Optional merge: ((first, second) => TReturn)
        • (first, second): TReturn
        • Parameters

          • first: TReturn
          • second: TReturn

          Returns TReturn

    Returns ((this, ...args) => TReturn)

      • (this, ...args): TReturn
      • Parameters

        • this: TThis
        • Rest ...args: TArgs

        Returns TReturn

  • Type Parameters

    • TArgs extends unknown[]

    • TReturn

    • TThis

    Parameters

    • first: undefined | ((this, ...args) => TReturn)
    • second: undefined | ((this, ...args) => TReturn)
    • Optional merge: ((first, second) => TReturn)
        • (first, second): TReturn
        • Parameters

          • first: TReturn
          • second: TReturn

          Returns TReturn

    Returns ((this, ...args) => TReturn) | undefined

Generated using TypeDoc