MCPcopy Create free account
hub / github.com/TruthHun/BookStack / getDiff

Function getDiff

static/editor.md/lib/codemirror/addon/merge/merge.js:549–563  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

547
548 var dmp = new diff_match_patch();
549 function getDiff(a, b) {
550 var diff = dmp.diff_main(a, b);
551 dmp.diff_cleanupSemantic(diff);
552 // The library sometimes leaves in empty parts, which confuse the algorithm
553 for (var i = 0; i < diff.length; ++i) {
554 var part = diff[i];
555 if (!part[1]) {
556 diff.splice(i--, 1);
557 } else if (i && diff[i - 1][0] == part[0]) {
558 diff.splice(i--, 1);
559 diff[i][1] += part[1];
560 }
561 }
562 return diff;
563 }
564
565 function getChunks(diff) {
566 var chunks = [];

Callers 2

merge.jsFile · 0.85
ensureDiffFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected