1.1.1 • Published 5 years ago

diff-lines v1.1.1

Weekly downloads
2,515
License
MIT
Repository
github
Last release
5 years ago

diff-lines

build status

Given two strings, show the lines that differ. (similar to git diff)

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:

 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