Files: c5c7a8ffadbd51aa28a5f3f096fe43f69405da44 / test / test-79-npm / diff / diff.js
404 bytesRaw
1 | ; |
2 | |
3 | var jsdiff = require('diff'); |
4 | var one = 'beep boop'; |
5 | var other = 'beep boob blah'; |
6 | var diff = jsdiff.diffChars(one, other); |
7 | var join = ''; |
8 | |
9 | diff.forEach(function (part) { |
10 | var color = 'grey'; |
11 | if (part.added) color = 'green'; |
12 | if (part.removed) color = 'red'; |
13 | join += color + ':[' + part.value + ']'; |
14 | }); |
15 | |
16 | if (join === 'grey:[beep boo]red:[p]green:[b blah]') { |
17 | console.log('ok'); |
18 | } |
19 |
Built with git-ssb-web