https://github.com/smallhelm/diff-lines
Given two strings, show the lines that differ. (similar to `git diff`)
https://github.com/smallhelm/diff-lines
Last synced: 10 months ago
JSON representation
Given two strings, show the lines that differ. (similar to `git diff`)
- Host: GitHub
- URL: https://github.com/smallhelm/diff-lines
- Owner: smallhelm
- License: mit
- Created: 2016-06-22T16:27:34.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2019-06-17T18:17:02.000Z (almost 7 years ago)
- Last Synced: 2024-12-03T05:23:39.722Z (over 1 year ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# diff-lines
[](https://travis-ci.org/smallhelm/diff-lines)
Given two strings, show the lines that differ. (similar to `git diff`)
```js
var diff = require('diff-lines');
var a = '';
a += 'one\n';
a += 'two\n';
a += 'three\n';
var b = '';
b += 'one\n';
b += 'three\n';
b += 'four\n';
console.log(diff(a, b));
```
Output:
```txt
one
-two
three
+four
```
## API
### diff(a, b[, options])
* `options.n_surrounding` - number of lines surrounding a diff to show. (default -1, show all lines)
## License
MIT