• Replace a method in an object with a wrapped version of itself.

    Parameters

    • source: {
          [key: string]: any;
      }

      An object that contains a method to be wrapped.

      • [key: string]: any
    • name: string

      The name of the method to be wrapped.

    • replacementFactory: ((...args) => any)

      A higher-order function that takes the original version of the given method and returns a wrapped version. Note: The function returned by replacementFactory needs to be a non-arrow function, in order to preserve the correct value of this, and the original method must be called using origMethod.call(this, <other args>) or origMethod.apply(this, [<other args>]) (rather than being called directly), again to preserve this.

        • (...args): any
        • Parameters

          • Rest ...args: any[]

          Returns any

    Returns void

    void

Generated using TypeDoc