Overwrites properties of the given object and returns the old values
968142
function patch(obj, properties) {
  var old = {};
  for (var name in properties) {
    old[name] = obj[name];
    obj[name] = properties[name];
  }
  return old;
}
528865
def old_properties_names_to_new(self):
        
        old_properties = getattr(self.__class__, "old_properties", {})
        for old_name, new_name in list(old_properties.items()):
            # Ok, if we got old_name and NO new name,
            # we switch the name
            if hasattr(self, old_name) and not hasattr(self, new_name):
                value = getattr(self, old_name)
                setattr(self, new_name, value)
                delattr(self, old_name)
987853
function memoize(value, objectKey) {
            const oldValue = memoized[memoizedIndex];
            if (oldValue !== undefined) {
                memoizedMap.delete(oldValue);
                memoizedObjectMap.delete(oldValue);
            }
            
            if (objectKey)
                memoizedObjectMap.set(objectKey, memoizedIndex);
            else
                memoizedMap.set(value, memoizedIndex);
            memoized[memoizedIndex] = value;
            
            memoizedIndex++;
            if (memoizedIndex >= maxDictSize + MIN_DICT_INDEX)
                memoizedIndex = MIN_DICT_INDEX;
        }
62823
function replace (obj, key, val) {
  if (obj.hasOwnProperty(key)) obj[key] = val;
  return obj;
}
908844
def rename_object(self, old, new):
        """"""
        self._objects.replace(old, new)
        pairs = self._pairs
        pairs |= {(new, p) for p in self._properties
            if (old, p) in pairs and not pairs.remove((old, p))}
4347
function replaceObject(dryReplacer, value, chain, flags, is_wrap, holder, path, value_paths, key) {

	var class_name,
	    seen_path,
	    new_value,
	    replaced,
	    is_array,
	    keys,
	    last,
	    temp,
	    len,
	    i;

	if (typeof value.constructor == 'function') {
		class_name = value.constructor.name;
	} else {
		class_name = 'Object';
	}

	// See if the chain needs popping
	while (len = chain.length) {

		// If the current object at the end of the chain does not
		// match the current holder, move one up
		// Don't mess with the chain if this is a wrap object
		if (!is_wrap && holder !== chain[len-1]) {

			last = chain.pop();

			// Only pop the path if the popped object isn't a wrapper
			if (last && !last.__is_wrap) {
				path.pop();
			}
		} else {
			break;
		}
	}

	// Has the object been seen before?
	seen_path = value_paths.get(value);

	if (seen_path) {

		// If the path is still an array,
		// turn it into a string now
		if (typeof seen_path != 'string') {

			// First iterate over the pieces and escape them
			for (i = 0; i < seen_path.length; i++) {
				if (seen_path[i].indexOf(special_char) > -1) {
					seen_path[i] = seen_path[i].replace(special_char_rg, safe_special_char);
				}
			}

			seen_path = special_char + seen_path.join(special_char);
			value_paths.set(value, seen_path);
		}

		// Replace the value with the path
		new_value = seen_path;

		// See if the new path is shorter
		len = 1;
		for (i = 0; i < path.length; i++) {
			len += 1 + path[i].length;
		}
		len += key.length;

		if (len < seen_path.length) {
			temp = seen_path;
			seen_path = path.slice(0);

			// The key of the current value still needs to be added
			seen_path.push(key);

			// First iterate over the pieces and escape them
			for (i = 0; i < seen_path.length; i++) {
				if (seen_path[i].indexOf(special_char) > -1) {
					seen_path[i] = seen_path[i].replace(special_char_rg, safe_special_char);
				}
			}

			seen_path = special_char + seen_path.join(special_char);
			value_paths.set(value, seen_path);

			// This entry still has to refer to the longer path,
			// otherwise it'll refer to itself
			seen_path = temp;
		}

		value = new_value;

		return value;
	}

	if (!flags.is_root && !is_wrap) {
		path.push(key);
	} else {
		flags.is_root = false;
	}

	// Make a copy of the current path array
	value_paths.set(value, path.slice(0));

	if (driers[class_name] != null) {
		value = driers[class_name].fnc(holder, key, value);

		value = {
			dry: class_name,
			value: value
		};

		if (driers[class_name].options.add_path !== false) {
			value.drypath = path.slice(0);
		}

		replaced = {'': value};
	} else if (class_name === 'RegExp' && value.constructor == RegExp) {
		value = {dry: 'regexp', value: value.toString()};
		replaced = {'': value};
	} else if (class_name === 'Date' && value.constructor == Date) {
		value = {dry: 'date', value: value.toISOString()};
		replaced = {'': value};
	} else if (typeof value.toDry === 'function') {
		temp = value;
		value = value.toDry();

		// If no path was supplied in the toDry,
		// get some more class information
		if (!value.path) {
			if (temp.constructor) {
				if (!value.namespace && temp.constructor.namespace) {
					value.namespace = temp.constructor.namespace;
				}

				if (!value.dry_class) {
					value.dry_class = temp.constructor.name;
				}
			}
		}

		value.dry = 'toDry';
		value.drypath = path.slice(0);
		replaced = {'': value};
	} else if (typeof value.toJSON === 'function') {
		value = value.toJSON();
		replaced = {'': value};
	} else {
		is_array = Array.isArray(value);
	}

	if (replaced) {
		// Push the replaced object on the chain
		chain.push(replaced);

		// Jsonify the replaced object
		value = dryReplacer(replaced, false, replaced['']);

		// At least one part of the path & chain will have
		// to be popped off. This is needed for toJSON calls
		// that return primitive values
		temp = chain.pop();

		// Don't pop off anything from the path if the last item
		// from the chain was a wrapper for an object,
		// because then it'll already be popped of
		if (!(temp && temp.__is_wrap && temp.__is_object)) {
			path.pop();
		}

		// Break out of the switch
		return value;
	}

	// Push this object on the chain
	chain.push(value);

	if (is_array) {
		new_value = [];

		for (i = 0; i < value.length; i++) {
			new_value[i] = dryReplacer(value, String(i), value[i]);
		}
	} else {
		new_value = recurseGeneralObject(dryReplacer, value);
	}

	value = new_value;

	return value;
}
374218
function update (obj1, obj2) {
  Object.keys(obj2).forEach(function (prop) {
    obj1[prop] = obj2[prop];
  });
  return obj1;
}
480776
function (dest, src) {
        var prop;

        // update or add values from src
        for (prop in src) {
            if (src.hasOwnProperty(prop)) {
                dest[prop] = src[prop];
            }
        }

        // remove values that no longer exist
        for (prop in dest) {
            if (dest.hasOwnProperty(prop) && !src.hasOwnProperty(prop)) {
                delete dest[prop];
            }
        }

        return dest;
    }
309997
function copyValueIfObject(where, how) {
    var what = where[VALUE];
    if (isObject(what)) {
      where[VALUE] = how(what);
    }
  }
632125
function copyExistingProperties(src, dst) {
  Object.keys(dst).forEach(function(key) {
    if (dst.hasOwnProperty(key) && src.hasOwnProperty(key)) {
      dst[key] = src[key];
    }
  });
}
388117
function wash(obj) {
	if (!obj) {
		return {};
	}

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

		if (obj[key] === undefined) {
			delete obj[key];
		}
	}

	return obj;
}
540556
function clearObject(object) {
  var key;

  for (key in object) {
    if (object.hasOwnProperty(key)) {
      // Ensures only writable properties are deleted.
      try {
        delete object[key];
      } catch (e) { }
    }
  }
}
72077
public boolean replace(Object oldObj, Object newObj)
    {  
        if (nest != null)
        {
            return nest.replace(oldObj, newObj);
        }
        else
        {
            int sz = elements.size();
            for (int i = 0; i < sz; i++)
            {
                if (elements.get(i) == oldObj)
                {
                    elements.set(i,newObj);
                    return true;
                }     
            }
        }
        
        return false;
    }
919697
function(obj) {
  var cloned = {};
  for(var key in obj) {
    if(obj.hasOwnProperty(key)) {
      cloned[key] = obj[key];
    }
  }
  return cloned;
}
517304
function () {
                var curState = this._currentState;
                var initialArray = this.initialArray;
                var oldValues; // map of old values
                if (curState.initialArray == initialArray && !(this._changes & this.CHANGED_INITIAL_ARRAY)) {
                    return;
                }
                if (curState.initialArray) {
                    // there was already an array, let's keep its values
                    // to keep filteredInState when old values are reused
                    oldValues = new ariaUtilsStackHashMap();
                    var oldItems = this.items;
                    var oldItemsLength = oldItems.length, oldElt;
                    for (var i = 0; i < oldItemsLength; i++) {
                        oldElt = oldItems[i];
                        oldValues.push(oldElt.value, oldElt);
                    }
                }

                if (ariaUtilsType.isObject(initialArray)) {
                    var returnedItems = this._getItemsFromMap(oldValues);
                } else {
                    var returnedItems = this._getItemsFromArray(oldValues);
                }
                if (oldValues) {
                    this._removeListenersOnItems(oldValues.removeAll());
                    oldValues.$dispose();
                }
                this.items = returnedItems.items;
                var filteredOutElements = returnedItems.filteredOutElements;
                var arrayLength = this.items.length;
                curState.initialArray = initialArray;
                curState.sortOrder = this.SORT_INITIAL;
                curState.sortName = null;
                curState.sortKeyGetter = null;
                curState.pageSize = -1;
                this.filteredInCount = arrayLength - filteredOutElements;
                this.pages = [{ // page mode disabled: only one page
                    pageIndex : 0,
                    pageNumber : 1,
                    firstItemIndex : 0,
                    lastItemIndex : arrayLength - 1,
                    firstItemNumber : arrayLength > 0 ? 1 : 0,
                    lastItemNumber : this.filteredInCount
                }];
                this._changes = this._changes & !this.CHANGED_INITIAL_ARRAY; // don't add _CHANGED_PAGE_DATA because
                // we did the job here
            }
888609
function clone(object) {
  if (object === null || typeof object != "object") {
    return object;
  }
  const copy = object.constructor();
  for (const attr in object) {
    if (Object.prototype.hasOwnProperty.call(object, attr)) {
      copy[attr] = object[attr];
    }
  }

  return copy;
}
381852
def update_property(old, new):
    """"""
    update_generic(old.fdel, new.fdel)
    update_generic(old.fget, new.fget)
    update_generic(old.fset, new.fset)