---
category: reference
heading: "apply(document)"
---

Applies the patch to the given document and returns the result. Will not mutate the original document, however the new document may share some structure with the original.

* document  - The document to operate against.

Example:

    patched = mypatch.apply(mydoc);


Returns the patched document.

Throws:

* PatchApplyError if the patch could not apply against the given document

