Applies the list of patches as DOM updates.

@param {Array} patches
171263
function executePatch(patches) {
	for (let i = 0; i < patches.length; i++) {
		const patch = patches[i];

		switch (patch.type) {
			case patchTypes.updateText: {
				// Update text of a node with new text.
				const nodeOld = patch.nodeOld;
				const nodeNew = patch.nodeNew;

				nodeOld.element.textContent = nodeNew.data[""];
				nodeOld.node = nodeNew;

				break;
			}

			case patchTypes.updateData: {
				// Set attributes and events of a node with new data.
				const nodeOld = patch.nodeOld;
				const nodeOldNodeData = nodeOld.node.data;
				const nodeOldElement = nodeOld.element;
				const nodeNew = patch.nodeNew;
				const nodeNewData = nodeNew.data;

				// Set attributes on the DOM element.
				for (let key in nodeNewData) {
					const value = nodeNewData[key];

					if (key[0] === "@") {
						// Update the event listener.
						nodeOldElement.MoonEvents[key] = value;
					} else if (key !== "children") {
						// Remove the attribute if the value is false, and update it
						// otherwise.
						if (value === false) {
							nodeOldElement.removeAttribute(key);
						} else {
							nodeOldElement.setAttribute(key, value);
						}
					}
				}

				// Remove old attributes.
				for (let key in nodeOldNodeData) {
					if (!(key in nodeNewData)) {
						nodeOldElement.removeAttribute(key);
					}
				}

				nodeOld.node = nodeNew;

				break;
			}

			case patchTypes.appendNode: {
				// Append a node to the parent.
				const nodeParent = patch.nodeParent;
				const nodeOldNew = executeCreate(patch.nodeNew);

				nodeParent.element.appendChild(nodeOldNew.element);
				nodeParent.children.push(nodeOldNew);

				break;
			}

			case patchTypes.removeNode: {
				// Remove a node from the parent.
				const nodeParent = patch.nodeParent;

				// Pops the last child because the patches still hold a reference
				// to them. The diff phase can only create this patch when there
				// are extra old children, and popping nodes off of the end is more
				// efficient than removing at a specific index, especially because
				// they are equivalent in this case.
				nodeParent.element.removeChild(nodeParent.children.pop().element);

				break;
			}

			case patchTypes.replaceNode: {
				// Replaces an old node with a new node.
				const nodeOld = patch.nodeOld;
				const nodeOldElement = nodeOld.element;
				const nodeNew = patch.nodeNew;
				const nodeOldNew = executeCreate(nodeNew);
				const nodeOldNewElement = nodeOldNew.element;

				nodeOldElement.parentNode.replaceChild(nodeOldNewElement, nodeOldElement);

				nodeOld.element = nodeOldNewElement;
				nodeOld.node = nodeOldNew.node;
				nodeOld.children = nodeOldNew.children;

				break;
			}
		}
	}

	// Remove the current execution from the queue.
	executeQueue.shift();

	// If there is new data in the execution queue, continue to it.
	if (executeQueue.length !== 0) {
		if (performance.now() - executeStart >= 16) {
			// If the current frame doesn't have sufficient time left to keep
			// running then start the next execution in the next frame.
			requestAnimationFrame(() => {
				executeStart = performance.now();

				executeNext();
			});
		} else {
			executeNext();
		}
	}
}
263819
function patchEvents($el) {
    $.each(EVENT_PROPERTIES, function(eventName, properties) {
        $el.on(eventName, function(event) {
            if (event.originalEvent) {
                properties.forEach(function(propertyName) {
                    event[propertyName] = event.originalEvent[propertyName];
                });
            }
        });
    });
}
180806
def _get_patches(installed_only=False, root=None):
    '''
    
    '''
    patches = {}
    for element in __zypper__(root=root).nolock.xml.call('se', '-t', 'patch').getElementsByTagName('solvable'):
        installed = element.getAttribute('status') == 'installed'
        if (installed_only and installed) or not installed_only:
            patches[element.getAttribute('name')] = {
                'installed': installed,
                'summary': element.getAttribute('summary'),
            }

    return patches
701198
function (increment) {
        increment = increment || Semver.PATCH; // default is patch
        switch (increment) {
            /* jshint indent: false */
            case Semver.MAJOR:
                this.major++;
                this.minor = this.patch = 0;
                break;
            case Semver.MINOR:
                this.minor++;
                this.patch = 0;
                break;
            case Semver.PATCH:
                this.patch++;
                break;
        }
        return this;
    }
973654
function patch(config, nodes, offset) {
  var position = config.location.toPosition
  var length = nodes.length
  var index = -1
  var start = offset
  var children
  var node
  var end

  while (++index < length) {
    node = nodes[index]
    children = node.children

    if (children) {
      patch(config, children, start)
    }

    end = start + toString(node).length

    node.position = {start: position(start), end: position(end)}

    start = end
  }

  return nodes
}
973313
function patch(object, ops) {
  ops = Array.isArray(ops) ? ops : [ops];
  object = ops.reduce(function (ob, op) {
    op = (0, _parse2['default'])(op, ob);
    return operators[op.op].call(ob, op);
  }, object);
  // Re-convert the returned object into an
  // immutable structure, in case the entire
  // object was replaced with a POJO
  return _immutable2['default'].fromJS(object);
}
594634
function patch(Ware) {
  var AttachWare = unherit(Ware)
  var useFn = Ware.prototype.use

  AttachWare.prototype.use = use

  return wrap

  function wrap(fn) {
    return new AttachWare(fn)
  }

  /* Attach configurable middleware. */
  function use(attach) {
    var self = this
    var params = slice.call(arguments, 1)
    var index
    var length
    var fn

    /* Multiple attachers. */
    if ('length' in attach && typeof attach !== 'function') {
      index = -1
      length = attach.length

      /* So, `attach[0]` is a function, meaning its
       * either a list of `attachers` or its a `list`. */
      if (typeof attach[0] === 'function') {
        if (
          attach[1] !== null &&
          attach[1] !== undefined &&
          typeof attach[1] !== 'function'
        ) {
          self.use.apply(self, attach)
        } else {
          while (++index < length) {
            self.use.apply(self, [attach[index]].concat(params))
          }
        }
      } else {
        while (++index < length) {
          self.use(attach[index])
        }
      }

      return self
    }

    /* Single attacher. */
    fn = attach.apply(null, [self.context || self].concat(params))

    /* Store the attacher to not break `new Ware(otherWare)`
     * functionality. */
    if (!self.attachers) {
      self.attachers = []
    }

    self.attachers.push(attach)

    /* Pass `fn` to the original `Ware#use()`. */
    if (fn) {
      useFn.call(self, fn)
    }

    return self
  }
}
1263861
function patch(node) {
    var data = node.data || {};

    data.stem = stemmer(nlcstToString(node));

    node.data = data;
}
574232
function patch(prop) {
  return (key, value) => {
    const { schema, table } = findSchemaAndTable(key);

    return raw('UPDATE ?? SET ?? = ?? || ? WHERE id = ?', [`${schema ? `${schema}.` : ''}${table}`, prop, prop, JSON.stringify(value), key]);
  };
}
785584
function onPatchesNotify(patches) {
		// we are going to collect all patches
		this.patches.push.apply(this.patches, patches);
		// TODO: share priority
		queues.deriveQueue.enqueue(this.onPatchesDerive, this, [], {
			priority: this.priority
		});
	}
1073941
function patch(element, previous, style) {
  if (!previous && !style) {
    return style;
  }
  var rule;
  if (typeof style === 'object') {
    if (typeof previous === 'object') {
      for (rule in previous) {
        if (!style[rule]) {
          domElementCss(element, rule, null);
        }
      }
      domElementCss(element, style);
    } else {
      if (previous) {
        element.setAttribute('style', '');
      }
      domElementCss(element, style);
    }
  } else {
    element.setAttribute('style', style || '');
  }
}
426129
function mergePatch(oChange) {
			if (oChange.method !== "PATCH") {
				return false;
			}
			return aChangeSet.some(function (oCandidate) {
				if (oCandidate.method === "PATCH"
						&& oCandidate.headers["If-Match"] === oChange.headers["If-Match"]) {
					jQuery.extend(true, oCandidate.body, oChange.body);
					oChange.$resolve(oCandidate.$promise);
					return true;
				}
			});
		}
171005
function analyzePatch(patch) {
  const patchLines = patch.split('\n').reduce((reducedPatch, currentLine) => {
    if (currentLine.match(/^[-+]/)) {
      return reducedPatch.concat(currentLine.replace(/^[-+]+\s*/, ''));
    }
    return reducedPatch;
  }, []);
  return {
    lines: patchLines.length,
    chars: patchLines.join('').length
  };
}
345027
function trimNested(previous, current, opts) {
    // bail early if we want to keep nested dependencies
    if (opts.keepNested) {
        return current;
    }

    // purposes find patches from to
    // apply TO current FROM previous
    var patches = jsonDiff.diff(current, previous);

    if (!patches) {
        return current;
    }

    patches = removeTopLevelPatches(patches);

    if (patches.dependencies) {
        Object.keys(patches.dependencies)
            .forEach(function (key) {
                current.dependencies[key] =
                    previous.dependencies[key];
            });
    }

    return current;
}
792328
function(desc, f) {
    if (typeof desc === 'object') {
        f(desc.env);
        if (Array.isArray(desc.components)) {
            desc.components.forEach(function(x) { patchEnv(x, f);});
        }
    } else {
        var err = new Error('patchEnv: not an object');
        err['desc'] = desc;
        throw err;
    }
}
1366086
function(patch) {
			// patch [key, null] means 'remove'
			if (patch === null) {
				this.remove();
				return _getResolvedPromise(this);
			}
			// TODO: make sure that root node is not collapsed or modified
			// copy (most) attributes to node.ATTR or node.data.ATTR
			var name,
				promise,
				v,
				IGNORE_MAP = { children: true, expanded: true, parent: true }; // TODO: should be global

			for (name in patch) {
				v = patch[name];
				if (!IGNORE_MAP[name] && !$.isFunction(v)) {
					if (NODE_ATTR_MAP[name]) {
						this[name] = v;
					} else {
						this.data[name] = v;
					}
				}
			}
			// Remove and/or create children
			if (patch.hasOwnProperty("children")) {
				this.removeChildren();
				if (patch.children) {
					// only if not null and not empty list
					// TODO: addChildren instead?
					this._setChildren(patch.children);
				}
				// TODO: how can we APPEND or INSERT child nodes?
			}
			if (this.isVisible()) {
				this.renderTitle();
				this.renderStatus();
			}
			// Expand collapse (final step, since this may be async)
			if (patch.hasOwnProperty("expanded")) {
				promise = this.setExpanded(patch.expanded);
			} else {
				promise = _getResolvedPromise(this);
			}
			return promise;
		}
383278
public function patch(array $operations)
    {
        $patch = new Patch($operations);
        $data  = $patch->patch($this->_properties);

        $this->_properties = $data;
    }