Skip to content

Commit 5d22b46

Browse files
Martiikpdecker
authored andcommitted
Normalize doc/ex with Diff package.json naming from npmjs.com (kpdecker#245)
NOTES: * Option 2 Closes kpdecker#243
1 parent 305a2b3 commit 5d22b46

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,56 +15,56 @@ npm install diff --save
1515

1616
## API
1717

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.
1919

2020
Returns a list of change objects (See below).
2121

2222
Options
2323
* `ignoreCase`: `true` to ignore casing difference. Defaults to `false`.
2424

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.
2626

2727
Returns a list of change objects (See below).
2828

2929
Options
3030
* `ignoreCase`: Same as in `diffChars`.
3131

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.
3333

3434
Returns a list of change objects (See below).
3535

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.
3737

3838
Options
3939
* `ignoreWhitespace`: `true` to ignore leading and trailing whitespace. This is the same as `diffTrimmedLines`
4040
* `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.
4141

4242
Returns a list of change objects (See below).
4343

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.
4545

4646
Returns a list of change objects (See below).
4747

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.
4949

5050
Returns a list of change objects (See below).
5151

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.
5353

5454
Returns a list of change objects (See below).
5555

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.
5757

5858
Returns a list of change objects (See below).
5959

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 (===).
6161

6262
Options
6363
* `comparator`: `function(left, right)` for custom equality checks
6464

6565
Returns a list of change objects (See below).
6666

67-
* `JsDiff.createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader)` - creates a unified diff patch.
67+
* `Diff.createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader)` - creates a unified diff patch.
6868

6969
Parameters:
7070
* `oldFileName` : String to be output in the filename section of the patch for the removals
@@ -75,12 +75,12 @@ npm install diff --save
7575
* `newHeader` : Additional information to include in the new file header
7676
* `options` : An object with options. Currently, only `context` is supported and describes how many lines of context should be included.
7777

78-
* `JsDiff.createPatch(fileName, oldStr, newStr, oldHeader, newHeader)` - creates a unified diff patch.
78+
* `Diff.createPatch(fileName, oldStr, newStr, oldHeader, newHeader)` - creates a unified diff patch.
7979

80-
Just like JsDiff.createTwoFilesPatch, but with oldFileName being equal to newFileName.
80+
Just like Diff.createTwoFilesPatch, but with oldFileName being equal to newFileName.
8181

8282

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.
8484

8585
This method is similar to createTwoFilesPatch, but returns a data structure
8686
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
9696
}
9797
```
9898

99-
* `JsDiff.applyPatch(source, patch[, options])` - applies a unified diff patch.
99+
* `Diff.applyPatch(source, patch[, options])` - applies a unified diff patch.
100100

101101
Return a string containing new version of provided data. `patch` may be a string diff or the output from the `parsePatch` or `structuredPatch` methods.
102102

@@ -105,7 +105,7 @@ npm install diff --save
105105
- `fuzzFactor`: Number of lines that are allowed to differ before rejecting a patch. Defaults to 0.
106106
- `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. Should return false if the lines should be rejected.
107107

108-
* `JsDiff.applyPatches(patch, options)` - applies one or more patches.
108+
* `Diff.applyPatches(patch, options)` - applies one or more patches.
109109

110110
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:
111111

@@ -114,9 +114,9 @@ npm install diff --save
114114
115115
Once all patches have been applied or an error occurs, the `options.complete(err)` callback is made.
116116
117-
* `JsDiff.parsePatch(diffStr)` - Parses a patch into structured data
117+
* `Diff.parsePatch(diffStr)` - Parses a patch into structured data
118118
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`.
120120
121121
* `convertChangesToXML(changes)` - converts a list of changes to a serialized XML format
122122
@@ -138,12 +138,12 @@ Basic example in Node
138138
139139
```js
140140
require('colors');
141-
var jsdiff = require('diff');
141+
var Diff = require('diff');
142142
143143
var one = 'beep boop';
144144
var other = 'beep boob blah';
145145
146-
var diff = jsdiff.diffChars(one, other);
146+
var diff = Diff.diffChars(one, other);
147147
148148
diff.forEach(function(part){
149149
// green for additions, red for deletions
@@ -170,7 +170,7 @@ var one = 'beep boop',
170170
color = '',
171171
span = null;
172172
173-
var diff = JsDiff.diffChars(one, other),
173+
var diff = Diff.diffChars(one, other),
174174
display = document.getElementById('display'),
175175
fragment = document.createDocumentFragment();
176176

examples/node_example.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
require('colors')
2-
var jsdiff = require('../');
2+
var Diff = require('../');
33

44
var one = 'beep boop';
55
var other = 'beep boob blah';
66

7-
var diff = jsdiff.diffChars(one, other);
7+
var diff = Diff.diffChars(one, other);
88

99
diff.forEach(function(part){
1010
// green for additions, red for deletions
@@ -14,4 +14,4 @@ diff.forEach(function(part){
1414
process.stderr.write(part.value[color]);
1515
});
1616

17-
console.log();
17+
console.log();

examples/web_example.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
color = '',
77
span = null;
88

9-
var diff = JsDiff.diffChars(one, other),
9+
var diff = Diff.diffChars(one, other),
1010
display = document.getElementById('display'),
1111
fragment = document.createDocumentFragment();
1212

0 commit comments

Comments
 (0)