static getDifferenceFromConfigObjects(object, base) {
    const isObject = (obj) => {
      return obj && typeof obj === 'object' && !Array.isArray(obj);
    };

    const isArrayEmpty = (array) => {
      return Array.isArray(array) && array.length === 0;
    };

    const changes = (object, base) => {
      return Object.keys(object).reduce((acc, key) => {
        const value = object[key];
        // eslint-disable-next-line no-prototype-builtins
        if (!base.hasOwnProperty(key)) {
          acc[key] = value;
        } else if (value instanceof HTMLElement &&
          base[key] instanceof HTMLElement) {
          if (!value.isEqualNode(base[key])) {
            acc[key] = value;
          }
        } else if (isObject(value) && isObject(base[key])) {
          const diff = changes(value, base[key]);
          if (Object.keys(diff).length > 0 || !isObject(diff)) {
            acc[key] = diff;
          }
        } else if (Array.isArray(value) && Array.isArray(base[key])) {
          if (!shaka.util.ArrayUtils.hasSameElements(value, base[key])) {
            acc[key] = value;
          }
        } else if (Number.isNaN(value) && Number.isNaN(base[key])) {
          // Do nothing if both are NaN
        } else if (value !== base[key]) {
          acc[key] = value;
        }
        return acc;
      }, {});
    };

    const diff = changes(object, base);

    const removeEmpty = (obj) => {
      for (const key of Object.keys(obj)) {
        if (obj[key] instanceof HTMLElement) {
          // Do nothing if it's a HTMLElement
        } else if (isObject(obj[key]) && Object.keys(obj[key]).length === 0) {
          delete obj[key];
        } else if (isArrayEmpty(obj[key])) {
          delete obj[key];
        } else if (typeof obj[key] == 'function') {
          delete obj[key];
        } else if (isObject(obj[key])) {
          removeEmpty(obj[key]);
          if (Object.keys(obj[key]).length === 0) {
            delete obj[key];
          }
        }
      }
    };

    removeEmpty(diff);
    return diff;
  }
@param {!Object} object
@param {!Object} base
@return {!Object}
@export