2.0.1 • Published 5 years ago

native-diff-match-patch v2.0.1

Weekly downloads
5
License
Apache-2.0
Repository
github
Last release
5 years ago

Native Diff-Match-Patch

C++ version of diff-match-patch exposed as a node module. This uses a heavily-modified version of the C++ diff-match-patch. It is binary safe.

Development status: Working. We use it in production.

Build Status

Floobits Status

Dependencies

This is a native module that depends on Qt5.

Usage

Here is an example of applying a patch:

var buffer,
  DMP,
  result,
  patch_text;

DMP = require("native-diff-match-patch");

// If you like, you can change DMP's thresholds
DMP.set_Patch_DeleteThreshold(0.375);
DMP.set_Match_Threshold(0.375);
DMP.set_Match_Distance(100);

buffer = "abc";
patch_text = "@@ -1,3 +1,2 @@\n" +
             " ab\n" +
             "-c";

result = DMP.patch_apply(patch_text, buffer);

for (i = 0; i < result[1].length; i++) {
  if (result[1][i] !== true) {
    throw new Error("Patch not applied cleanly.");
  }
}

buffer = result[0];

// This prints "ab"
console.log(buffer);
2.0.1

5 years ago

2.0.0

7 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago

0.0.4

12 years ago

0.0.3

12 years ago

0.0.2

12 years ago

0.0.1

12 years ago