diff-lines

1.1.1 • Public • Published

diff-lines

build status

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

var diff = require('diff-lines');
 
var a = '';
+= 'one\n';
+= 'two\n';
+= 'three\n';
 
var b = '';
+= 'one\n';
+= 'three\n';
+= '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

Readme

Keywords

Package Sidebar

Install

npm i diff-lines

Weekly Downloads

1,272

Version

1.1.1

License

MIT

Unpacked Size

3.72 kB

Total Files

4

Last publish

Collaborators

  • farskipper