src/utils/merge.js
function forEach(obj, fn) {
  // Don't bother if no value provided
  if (obj === null || typeof obj === 'undefined') {
    return;
  }

  // Force an array if not already something iterable
  if (typeof obj !== 'object') {
    /* eslint no-param-reassign:0 */
    obj = [obj];
  }

  if (Array.isArray(obj)) {
    // Iterate over array values
    for (let i = 0, l = obj.length; i < l; i += 1) {
      fn.call(null, obj[i], i, obj);
    }
  } else {
    // Iterate over object keys
    Object.entries(obj).forEach(([key, val]) => {
      fn.call(null, val, key, obj);
    });
  }
}
function forEach(obj, fn) {
  // Don't bother if no value provided
  if (obj === null || typeof obj === 'undefined') {
    return;
  }

  // Force an array if not already something iterable
  if (typeof obj !== 'object') {
    /* eslint no-param-reassign:0 */
    obj = [obj];
  }

  if (Array.isArray(obj)) {
    // Iterate over array values
    for (let i = 0, l = obj.length; i < l; i += 1) {
      fn.call(null, obj[i], i, obj);
    }
  } else {
    // Iterate over object keys
    Object.entries(obj).forEach(([key, val]) => {
      fn.call(null, val, key, obj);
    });
  }
}
function forEach ( obj , fn ) { // Don't bother if no value provided if ( obj === null || typeof obj === 'undefined' ) { return ; } // Force an array if not already something iterable if ( typeof obj !== 'object' ) { /* eslint no-param-reassign:0 */ obj = [ obj ] ; } if ( Array . isArray ( obj ) ) { // Iterate over array values for ( let i = 0 , l = obj . length ; i < l ; i += 1 ) { fn . call ( null , obj [ i ] , i , obj ) ; } } else { // Iterate over object keys Object . entries ( obj ) . forEach ( ( [ key , val ] ) => { fn . call ( null , val , key , obj ) ; } ) ; } }
This is copied from axios utils to preserve axios's logic
This is copied from axios utils to preserve axios s logic