function fill(source, name, replacementFactory) {
    if (!(name in source)) {
        return;
    }
    var original = source[name];
    var wrapped = replacementFactory(original);
    // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work
    // otherwise it'll throw "TypeError: Object.defineProperties called on non-object"
    if (typeof wrapped === 'function') {
        try {
            markFunctionWrapped(wrapped, original);
        }
        catch (_Oo) {
            // This can throw if multiple fill happens on a global object like XMLHttpRequest
            // Fixes https://github.com/getsentry/sentry-javascript/issues/2043
        }
    }
    source[name] = wrapped;
}
Replace a method in an object with a wrapped version of itself.

@param source An object that contains a method to be wrapped.
@param name The name of the method to be wrapped.
@param replacementFactory 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`.
@returns void