Skip to content

Commit f59f917

Browse files
committed
revert decision of supporting older node to allow for migration, update doc
1 parent 8d5591e commit f59f917

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
language: node_js
22
node_js:
3+
- '6'
4+
- '8'
35
- '10'
46
- '12'
57
- '13'

bin/text-file-diff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
2-
const LargeFileDiff = require('../index.js');
2+
const TextFileDiff = require('../index.js');
33

44
const argv = process.argv;
55

@@ -12,7 +12,7 @@ if (argv.length < 4) {
1212
const file1 = argv[2];
1313
const file2 = argv[3];
1414

15-
const lfd = new LargeFileDiff({
15+
const lfd = new TextFileDiff({
1616
skipHeader: argv.skipHeader
1717
});
1818

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const ReadlinesSync = require('n-readlines');
88
* @return Number 0 for equals, 1 if line1 > line2 or -1
99
*/
1010
function defaultLineComparer(line1, line2) {
11-
line1 = String(line1).trim();
12-
line2 = String(line2).trim();
11+
line1 = String(line1);
12+
line2 = String(line2);
1313
return line1 > line2 ? 1 : (line1 < line2 ? -1 : 0);
1414
}
1515

@@ -47,7 +47,7 @@ class TextFileDiff extends EventEmitter {
4747
* @param Object options the options option
4848
* @return Object self
4949
*/
50-
constructor(options) {
50+
constructor(options={}) {
5151
super();
5252
Object.assign(this, options);
5353
return this;

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "text-file-diff",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "line by line diff of two large files",
55
"license": "MIT",
66
"repository": "niiknow/text-file-diff",
@@ -10,7 +10,7 @@
1010
"url": "niiknow.org"
1111
},
1212
"engines": {
13-
"node": ">=10"
13+
"node": ">=6"
1414
},
1515
"scripts": {
1616
"test": "xo && nyc ava",

readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ m.on('+', line => {
4848
m.diff('tests/file1.txt', 'tests/file2.txt');
4949
```
5050

51+
**TextFileDiff** constructor also accept optional options object. Valid options are:
52+
1. `skipHeader` - boolean indicating if first line should be skipped
53+
2. `charset` - default to `utf8`
54+
3. `compareFn` - line comparer function that take in two line (line1 and line2), and `return line1 > line2 ? 1 : (line1 < line2 ? -1 : 0)` allowing you to define how you want to perform line compare.
55+
5156
## Example
5257
```bash
5358
$ ./bin/text-file-diff tests/file1.txt tests/file2.txt

0 commit comments

Comments
 (0)