Files: d456a6cc8589489e558e6164750474ed2cfc961e / 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