cdp-diff
v0.0.13
Published
object diffing tool used by the Cheese Diff Protocol (CDP)
Downloads
7
Readme
cdp-diff
This is the tool used by Cheese to create diffs for the Cheese Diff Protocol (CDP). This module can be used independently in node.js as well as the browser.
Installation
node
$ npm install --save cdp-diff
browser
Use bower:
$ bower install --save cdp-diff
Or download ./lib/cdp-diff.js
and put it in a script tag.
API
diff.createDiff(old, new)
Create a diff between two objects, old
and new
. Applying this diff to old
will turn old
into new
. This function returns the diff that was created.
diff.applyDiff(diff, obj)
Apply a diff (diff
) to an object (obj
). diff
must be created by diff.createDiff
, or must follow the same format. This function does not copy the object (obj
) before applying the diff, so whatever object this function is called with will be modified. This function returns the modified object.
diff.copyObject(obj)
Copy an object (obj
). This function returns a copy of the object.
License
MIT License. See ./LICENSE
for details.