ts-playground
    Preparing search index...

    Function assertiveFunctionMerger

    • Combines two functions into one, asserting that they produce the same result.

      Type Parameters

      • Fn extends (...args: Parameters<Fn>) => ReturnType<Fn>

      Parameters

      • fnA: Fn

        The first function to combine.

      • fnB: Fn

        The second function to combine.

      • Optionaloptions: Options<Fn>
        • testFn

          A function to assert the equality of the two function results. (optional) defaults to deep equality check with JSON.stringify

        • errorFn

          A function to call when the two functions produce different results. (optional) defaults to logging error to console

      Returns Fn

      A new function that combines the behavior of the two input functions.