@@ -5,6 +5,50 @@ A javascript text differencing implementation.
55Based on the algorithm proposed in
66[ "An O(ND) Difference Algorithm and its Variations" (Myers, 1986)] ( http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927 ) .
77
8+ ## API  
9+ 
10+ *  JsDiff.diffChars(oldStr, newStr)
11+     Diffs two blocks of text, comparing character by character.
12+ 
13+     Returns a list of change objects (See below).
14+ 
15+ *  JsDiff.diffWords(oldStr, newStr)
16+     Diffs two blocks of text, comparing word by word.
17+ 
18+     Returns a list of change objects (See below).
19+ 
20+ *  JsDiff.diffLines(oldStr, newStr)
21+     Diffs two blocks of text, comparing line by line.
22+ 
23+     Returns a list of change objects (See below).
24+ 
25+ *  JsDiff.diffCss(oldStr, newStr)
26+     Diffs two blocks of text, comparing CSS tokens.
27+ 
28+     Returns a list of change objects (See below).
29+ 
30+ *  JsDiff.createPatch(fileName, oldStr, newStr, oldHeader, newHeader)
31+     Creates a unified diff patch.
32+ 
33+     Parameters:
34+     *  fileName : String to be output in the filename sections of the patch
35+     *  oldStr : Original string value
36+     *  newStr : New string value
37+     *  oldHeader : Additional information to include in the old file header
38+     *  newHeader : Additional information to include in thew new file header
39+ 
40+ *  convertChangesToXML(changes)
41+     Converts a list of changes to a serialized XML format
42+ 
43+ ### Change Objects  
44+ Many of the methods above return change objects. These objects are consist of the following fields:
45+ 
46+ *  value: Text content
47+ *  added: True if the value was inserted into the new string
48+ *  removed: True of the value was removed from the old string
49+ 
50+ Note that some cases may omit a particular flag field. Comparison on the flag fields should always be done in a truthy or falsy manner.
51+ 
852## License  
953
1054Software License Agreement (BSD License)
0 commit comments