Override the function value for the given object

@param {?Object} curr the current object
@param {?Object} old the old object
@return {?Object}
function overrideObjectFunctions(curr, old) {
    if (!old) {
        return curr;
    }

    if (!curr && curr !== undefined) {
        return old;
    }

    let result = {};
    Object.keys(curr).forEach(k => {
        let v = curr[k];
        let oldV = old[k];
        if (typeof v === 'function' && typeof oldV === 'function') {
            let currV = v;
            v = function (...args) {
                oldV.apply(this, args);
                currV.apply(this, args);
            };
        }
        result[k] = v;
    });

    return result;
}