code: function patch(obj, properties) {
    var old = {};
    for (var name in properties) {
      old[name] = obj[name];
      obj[name] = properties[name];
    }
    return old;
  }
docs: Overwrites properties of the given object and returns the old values