Skip to content

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

License

Notifications You must be signed in to change notification settings

smallhelm/diff-lines

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published