lib/functions/merge.js
function merge(target) {
  for (var _len = arguments.length, sources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    sources[_key - 1] = arguments[_key];
  }

  if (!sources.length) return target;
  var source = sources.shift();

  if ((0, _isObject2.default)(target) && (0, _isObject2.default)(source)) {
    for (var key in source) {
      if ((0, _isObject2.default)(source[key])) {
        if (!target[key]) Object.assign(target, _defineProperty({}, key, {}));
        merge(target[key], source[key]);
      } else {
        Object.assign(target, _defineProperty({}, key, source[key]));
      }
    }
  }

  return merge.apply(undefined, [target].concat(sources));
}
function merge(target) {
  for (var _len = arguments.length, sources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    sources[_key - 1] = arguments[_key];
  }

  if (!sources.length) return target;
  var source = sources.shift();

  if ((0, _isObject2.default)(target) && (0, _isObject2.default)(source)) {
    for (var key in source) {
      if ((0, _isObject2.default)(source[key])) {
        if (!target[key]) Object.assign(target, _defineProperty({}, key, {}));
        merge(target[key], source[key]);
      } else {
        Object.assign(target, _defineProperty({}, key, source[key]));
      }
    }
  }

  return merge.apply(undefined, [target].concat(sources));
}
function merge ( target ) { for ( var _len = arguments . length , sources = Array ( _len > 1 ? _len - 1 : 0 ) , _key = 1 ; _key < _len ; _key ++ ) { sources [ _key - 1 ] = arguments [ _key ] ; } if ( ! sources . length ) return target ; var source = sources . shift ( ) ; if ( ( 0 , _isObject2 . default ) ( target ) && ( 0 , _isObject2 . default ) ( source ) ) { for ( var key in source ) { if ( ( 0 , _isObject2 . default ) ( source [ key ] ) ) { if ( ! target [ key ] ) Object . assign ( target , _defineProperty ( { } , key , { } ) ) ; merge ( target [ key ] , source [ key ] ) ; } else { Object . assign ( target , _defineProperty ( { } , key , source [ key ] ) ) ; } } } return merge . apply ( undefined , [ target ] . concat ( sources ) ) ; }
Recursively merge two objects.
@param target
@param ...sources
Recursively merge two objects .