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
+27-27
Original file line number
Diff line number
Diff line change
@@ -15,56 +15,56 @@ npm install diff --save
15
15
16
16
## API
17
17
18
-
*`JsDiff.diffChars(oldStr, newStr[, options])` - diffs two blocks of text, comparing character by character.
18
+
*`Diff.diffChars(oldStr, newStr[, options])` - diffs two blocks of text, comparing character by character.
19
19
20
20
Returns a list of change objects (See below).
21
21
22
22
Options
23
23
*`ignoreCase`: `true` to ignore casing difference. Defaults to `false`.
24
24
25
-
*`JsDiff.diffWords(oldStr, newStr[, options])` - diffs two blocks of text, comparing word by word, ignoring whitespace.
25
+
*`Diff.diffWords(oldStr, newStr[, options])` - diffs two blocks of text, comparing word by word, ignoring whitespace.
26
26
27
27
Returns a list of change objects (See below).
28
28
29
29
Options
30
30
*`ignoreCase`: Same as in `diffChars`.
31
31
32
-
*`JsDiff.diffWordsWithSpace(oldStr, newStr[, options])` - diffs two blocks of text, comparing word by word, treating whitespace as significant.
32
+
*`Diff.diffWordsWithSpace(oldStr, newStr[, options])` - diffs two blocks of text, comparing word by word, treating whitespace as significant.
33
33
34
34
Returns a list of change objects (See below).
35
35
36
-
*`JsDiff.diffLines(oldStr, newStr[, options])` - diffs two blocks of text, comparing line by line.
36
+
*`Diff.diffLines(oldStr, newStr[, options])` - diffs two blocks of text, comparing line by line.
37
37
38
38
Options
39
39
*`ignoreWhitespace`: `true` to ignore leading and trailing whitespace. This is the same as `diffTrimmedLines`
40
40
*`newlineIsToken`: `true` to treat newline characters as separate tokens. This allows for changes to the newline structure to occur independently of the line content and to be treated as such. In general this is the more human friendly form of `diffLines` and `diffLines` is better suited for patches and other computer friendly output.
41
41
42
42
Returns a list of change objects (See below).
43
43
44
-
*`JsDiff.diffTrimmedLines(oldStr, newStr[, options])` - diffs two blocks of text, comparing line by line, ignoring leading and trailing whitespace.
44
+
*`Diff.diffTrimmedLines(oldStr, newStr[, options])` - diffs two blocks of text, comparing line by line, ignoring leading and trailing whitespace.
45
45
46
46
Returns a list of change objects (See below).
47
47
48
-
*`JsDiff.diffSentences(oldStr, newStr[, options])` - diffs two blocks of text, comparing sentence by sentence.
48
+
*`Diff.diffSentences(oldStr, newStr[, options])` - diffs two blocks of text, comparing sentence by sentence.
49
49
50
50
Returns a list of change objects (See below).
51
51
52
-
*`JsDiff.diffCss(oldStr, newStr[, options])` - diffs two blocks of text, comparing CSS tokens.
52
+
*`Diff.diffCss(oldStr, newStr[, options])` - diffs two blocks of text, comparing CSS tokens.
53
53
54
54
Returns a list of change objects (See below).
55
55
56
-
*`JsDiff.diffJson(oldObj, newObj[, options])` - diffs two JSON objects, comparing the fields defined on each. The order of fields, etc does not matter in this comparison.
56
+
*`Diff.diffJson(oldObj, newObj[, options])` - diffs two JSON objects, comparing the fields defined on each. The order of fields, etc does not matter in this comparison.
57
57
58
58
Returns a list of change objects (See below).
59
59
60
-
*`JsDiff.diffArrays(oldArr, newArr[, options])` - diffs two arrays, comparing each item for strict equality (===).
60
+
*`Diff.diffArrays(oldArr, newArr[, options])` - diffs two arrays, comparing each item for strict equality (===).
61
61
62
62
Options
63
63
*`comparator`: `function(left, right)` for custom equality checks
Just like JsDiff.createTwoFilesPatch, but with oldFileName being equal to newFileName.
80
+
Just like Diff.createTwoFilesPatch, but with oldFileName being equal to newFileName.
81
81
82
82
83
-
*`JsDiff.structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options)` - returns an object with an array of hunk objects.
83
+
*`Diff.structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options)` - returns an object with an array of hunk objects.
84
84
85
85
This method is similar to createTwoFilesPatch, but returns a data structure
86
86
suitable for further processing. Parameters are the same as createTwoFilesPatch. The data structure returned may look like this:
@@ -96,7 +96,7 @@ npm install diff --save
96
96
}
97
97
```
98
98
99
-
*`JsDiff.applyPatch(source, patch[, options])`- applies a unified diff patch.
99
+
*`Diff.applyPatch(source, patch[, options])`- applies a unified diff patch.
100
100
101
101
Return a string containing newversionof provided data. `patch` may be a string diff or the output from the `parsePatch` or `structuredPatch` methods.
102
102
@@ -105,7 +105,7 @@ npm install diff --save
105
105
-`fuzzFactor`:Numberof lines that are allowed to differ before rejecting a patch. Defaults to 0.
106
106
-`compareLine(lineNumber, line, operation, patchContent)`: Callback used to compare to given lines to determine if they should be considered equal when patching. Defaults to strict equality but may be overridden to provide fuzzier comparison. Shouldreturnfalseif the lines should be rejected.
107
107
108
-
*`JsDiff.applyPatches(patch, options)`- applies one or more patches.
108
+
*`Diff.applyPatches(patch, options)`- applies one or more patches.
109
109
110
110
This method will iterate over the contents of the patch and apply to data provided through callbacks. The general flow for each patch index is:
111
111
@@ -114,9 +114,9 @@ npm install diff --save
114
114
115
115
Once all patches have been applied or an error occurs, the `options.complete(err)` callback is made.
116
116
117
-
* `JsDiff.parsePatch(diffStr)` - Parses a patch into structured data
117
+
* `Diff.parsePatch(diffStr)` - Parses a patch into structured data
118
118
119
-
Return a JSON object representation of the a patch, suitable for use with the `applyPatch` method. This parses to the same structure returned by `JsDiff.structuredPatch`.
119
+
Return a JSON object representation of the a patch, suitable for use with the `applyPatch` method. This parses to the same structure returned by `Diff.structuredPatch`.
120
120
121
121
* `convertChangesToXML(changes)` - converts a list of changes to a serialized XML format
0 commit comments