How to use the diff-match-patch.patch_obj function in diff-match-patch

To help you get started, we’ve selected a few diff-match-patch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / diff-match-patch / diff-match-patch-tests.ts View on Github external
function testPatchObj() {
    // Patch Object.
    const p = new DiffMatchPatch.patch_obj();
    assertEquals(null, p.start1);
    assertEquals(null, p.start2);

    p.start1 = 20;
    p.start2 = 21;
    p.length1 = 18;
    p.length2 = 17;
    p.diffs = [[DIFF_EQUAL, 'jump'], [DIFF_DELETE, 's'], [DIFF_INSERT, 'ed'], [DIFF_EQUAL, ' over '], [DIFF_DELETE, 'the'], [DIFF_INSERT, 'a'], [DIFF_EQUAL, '\nlaz']];
    const strp = p.toString();
    assertEquals('@@ -21,18 +22,17 @@\n jump\n-s\n+ed\n  over \n-the\n+a\n %0Alaz\n', strp);
}

diff-match-patch

npm package for https://github.com/google/diff-match-patch

Apache-2.0
Latest version published 4 years ago

Package Health Score

71 / 100
Full package analysis