You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-4Lines changed: 11 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Diff & patch JavaScript objects
12
12
13
13
- min+gzipped < 6KB
14
14
- browser (```/build/bundle.js```) and server (eg. node.js)
15
-
- includes [google-diff_match_patch](http://code.google.com/p/google-diff-match-patch/) for long text diffs (diff at characther level)
15
+
- includes [google-diff-match-patch](http://code.google.com/p/google-diff-match-patch/) for long text diffs (diff at characther level)
16
16
- smart array diffing using [LCS](http://en.wikipedia.org/wiki/Longest_common_subsequence_problem), ***IMPORTANT NOTE:*** to match objects inside an array you ***must*** provide an ```objectHash``` function, check [Array diff documentation](docs/arrays.md)
17
17
- reverse a delta
18
18
- unpatch (eg. revert object to its original state using a delta)
@@ -187,9 +187,9 @@ var jsondiffpatch = require('jsondiffpatch').create(options);
187
187
bower install jsondiffpatch
188
188
```
189
189
190
-
bundles to include are on the ```/build``` folder:
190
+
brower bundles are in the ```/build``` folder (run ```make``` or ```gulp``` to generate these):
191
191
- bundle.js main bundle
192
-
- bundle.full.js includes diff_match_patch library for text diffs
192
+
- bundle.full.js includes [google-diff-match-patch](http://code.google.com/p/google-diff-match-patch/) library for text diffs
193
193
- formatters.js includes builtin formatters (only those useful in a browser)
194
194
195
195
(all these include minified versions)
@@ -242,4 +242,11 @@ npm install -g jsondiffpatch
242
242
jsondiffpatch ./demo/left.json ./demo/right.json
243
243
```
244
244
245
-

245
+

246
+
247
+
Plugins
248
+
-------
249
+
250
+
```diff()```, ```patch()``` and ```reverse()``` functions are implemented using a pipes &filters pattern, making it extremely customizable by adding or replacing filters on a pipe.
251
+
252
+
Check [Plugins documentation](docs/formatters.md) for more info.
```diff()```, ```patch()``` and ```reverse()``` functions are implemented using a pipes &filters pattern, making it extremely customizable by adding or replacing filters on a pipe.
2
+
3
+
Some examples of what you can acheive writing your own filter:
4
+
- diff special custom objects (eg. DOM nodes, native objects, functions, RegExp, node.js streams?)
5
+
- ignore parts of the graph using any custom rule (type, path, flags)
6
+
- change diff strategy in specific parts of the graph, eg. rely on change tracking info for Knockout.js tracked objects
7
+
- implement custom diff mechanisms, like relative numeric deltas
8
+
- suprise me! :)
9
+
10
+
Check the ```/src/filters``` folder for more example code.
0 commit comments