merge two Mapping objects, keeping the type of the first mapping
557420
def _merge_maps(m1, m2):
    """"""
    return type(m1)(chain(m1.items(), m2.items()))
1146044
function merge_objects(obj1,obj2){
        var obj3 = {};
        for (var attrname1 in obj1) { obj3[attrname1] = obj1[attrname1]; }
        for (var attrname2 in obj2) { obj3[attrname2] = obj2[attrname2]; }
        return obj3;
    }
395893
private Map<String, String> mergeMaps(Map<String, String> map1, Map<String, String> map2) {
        Iterator<String> map1Names = map1.keySet().iterator();
        while (map1Names.hasNext()) {
            String name = map1Names.next();
            map2.put(name, map1.get(name));
        }
        return map2;
    }
202653
def merge_dict(dict_1, *other, **kw):
    """"""
    tmp = dict_1.copy()
    for x in other:
        tmp.update(x)
    tmp.update(kw)
    return tmp
822517
function copyAndOffsetMapping(existingMapping) {
    var column     = getColumnAfter(existingMapping.generatedLine - 1, existingMapping.generatedColumn);
    var newMapping = {
      generated: {
        line  : existingMapping.generatedLine,
        column: column
      }
    };
    if (existingMapping.source) {
      newMapping.source   = existingMapping.source;
      newMapping.original = {
        line  : existingMapping.originalLine,
        column: existingMapping.originalColumn
      };
      if (existingMapping.name) {
        newMapping.name = existingMapping.name;
      }
    }
    generator.addMapping(newMapping);
  }
1037608
function merge(source, target) {
    if (target == null) {
        return clone(source);
    }
    if (source == null) {
        return clone(target);
    }
    if (typeof source !== 'object' || typeof target !== 'object') {
        return clone(target);
    }
    const merge = (source, target) => {
        Object.keys(target).forEach(key => {
            if (source[key] == null) {
                source[key] = target[key];
            } else if (typeof source[key] === 'object') {
                if (typeof target[key] === 'object') {
                    merge(source[key], target[key]);
                } else {
                    source[key] = target[key];
                }
            } else {
                source[key] = target[key];
            }
        });

        return source;
    };

    return merge(clone(source), clone(target));
}
725441
function merge(obj1, obj2) {
  if (obj1 == null && obj2 == null) {
    return null;
  }
  const merged = { ...obj1 };
  for (const prop in obj2) {
    if (obj2[prop] != null) {
      merged[prop] = obj2[prop];
    }
  }
  return merged;
}
658092
function mergeObject(target, source, create) {
  if (!source || !target) return;
  for (let pn in source) {
    if (_.has(target, pn) || create)
      target[pn] = source[pn];
  }
}
811888
function mergeWithoutOverwrite(object1, object2) {
		if (object1 === object2) {
			return object1;
		}

		var oMergedObject = {};

		// Clone object1
		Object.keys(object1).forEach(function(sKey) {
			oMergedObject[sKey] = object1[sKey];
		});

		// merge
		Object.keys(object2).forEach(function(sKey) {
			if (!oMergedObject.hasOwnProperty(sKey)) {
				oMergedObject[sKey] = object2[sKey];
			}
		});

		return oMergedObject;
	}
607881
def merge(obj_a, obj_b, strategy='smart', renderer='yaml', merge_lists=False):
    '''
    
    '''
    return salt.utils.dictupdate.merge(obj_a, obj_b, strategy, renderer,
            merge_lists)
529445
function compareMappingsDeep(mapping1, mapping2) {
  return _.isEqualWith(mapping1, mapping2, (object1, object2, prop) => {
    let mapping1 = { [prop]: object1 }
    let mapping2 = { [prop]: object2 }
    if (prop == "from" || prop == "to") {
      if (!_.isEqual(Object.getOwnPropertyNames(_.get(object1, prop, {})), Object.getOwnPropertyNames(_.get(object2, prop, {})))) {
        return false
      }
      return _.isEqualWith(conceptsOfMapping(mapping1, prop), conceptsOfMapping(mapping2, prop), (concept1, concept2, index) => {
        if (index != undefined) {
          return compare(concept1, concept2)
        }
        return undefined
      })
    }
    if (prop == "fromScheme" || prop == "toScheme") {
      return compare(object1, object2)
    }
    // Let lodash's isEqual do the comparison
    return undefined
  })
}
801283
function merge(Obj1, Obj2) {
    if (typeof Obj1 != 'object') {
        return {};
    }
    if (typeof Obj2 != 'object') {
        return Obj1;
    }
    for (var index in Obj2) {
        if (Obj2.hasOwnProperty(index)) {
            Obj1[index] = Obj2[index];
        }
    }

    return Obj1;
}
1239015
function merge (schema, doc, self) {
  var keys = Object.keys(doc);

  for (var i = 0; i < keys.length; ++i) {
    var key = keys[i];
    var type;

    // if nothing in schema yet, just assign
    if ('undefined' == typeof schema[key]) {
      var type = self.getType(doc, key);
      if (undefined !== type) {
        schema[key] = type;
      }
      continue;
    }

    // exists in schema and incoming is an object?
    if (isObject(doc[key])) {
      if (isObject(schema[key])) {
        merge(schema[key], doc[key], self);

      } else {
        type = self.getType(doc, key);
        if (undefined !== type) {
          if ('null' == schema[key]) {
            schema[key] = type;
          } else if (type != schema[key]) {
            schema[key] = 'Mixed';
          }
        }
      }
    } else {
      // exists in schema and incoming is not an object.
      var type = self.getType(doc, key);
      if (undefined === type) {
        continue;
      }

      if ('null' == schema[key]) {
        schema[key] = type;

      } else if ('null' == type) {
        // ignore

      } else if (Array.isArray(schema[key]) && Array.isArray(type)) {

        if (0 === schema[key].length) {
          schema[key] = type;

        } else if (schema[key][0] instanceof Schema && isObject(type[0])) {
          // merge schemas
          schema[key][0].combine(type[0]);

        } else if (!equalType(schema[key], type)) {
          schema[key] = ['Mixed'];
        }

      } else if (!equalType(schema[key], type)) {
        schema[key] = 'Mixed';
      }
    }
  }
}
1271769
function merge(destination, source, preserve) {
        preserve = preserve || [];

        for (var property in source) {
          if (preserve.indexOf(property) === -1) {
            destination[property] = source[property];
          }
        }

        return destination;
      }
617147
function mergeObjectsInGecko(origin, add, opts) {
    "use strict";

    var options = opts || {},
        keepReferences = options.keepReferences;

    for (var p in add) {
        if (isPlainObject(add[p])) {
            if (isPlainObject(origin[p])) {
                origin[p] = mergeObjects(origin[p], add[p]);
            } else {
                origin[p] = keepReferences ? add[p] : clone(add[p]);
            }
        } else {
            // if a property is only a getter, we could have a Javascript error
            // in strict mode "TypeError: setting a property that has only a getter"
            // when setting the value to the new object (gecko 25+).
            // To avoid it, let's define the property on the new object, do not set
            // directly the value
            var prop = Object.getOwnPropertyDescriptor(add, p);
            if (prop.get && !prop.set) {
                Object.defineProperty(origin, p, prop);
            }
            else {
                origin[p] = add[p];
            }
        }
    }
    return origin;
}
298010
def merge(self, other, replacements=None):
        

        # TODO: is the current solution not optimal enough?
        for _, item in other._storage.items():  # type: RegionObject
            for so in item.stored_objects:  # type: StoredObject
                if replacements and so.obj in replacements:
                    so = StoredObject(so.start, replacements[so.obj], so.size)
                self._object_mapping[so.obj_id] = so
                self.__store(so, overwrite=False)

        return self
522671
def convert_mapping(self, mapping):
        """"""
        if isinstance(mapping, dict):
            return self.convert_items(iteritems(mapping))
        return self.convert_items(mapping)