DMP: Diff Match Patch
Development status: Production-ready.
Node.js module based on Neil Fraiser's excellent Diff Match Patch.
Install
Add dmp
to your package.json
or npm install dmp
.
This module requires Node.js v4.0 or later.
Use
const DMP = ;const dmp = ; let patches = dmp; console;// @@ -0,0 +1,4 @@// +abcd let patch_text = "@@ -0,0 +1,4 @@\n+abcd\n";patches = dmp; let result = dmp;console;// [ 'abcd', [ true ] ]
Configure
After creating a DMP object, you can tweak a few attributes. Don't mess with these unless you know what you're doing!
dmpPatch_DeleteThreshold = 0375;dmpMatch_Threshold = 0375;dmpMatch_Distance = 100;
Default values are:
Patch_DeleteThreshold = 05;Match_Threshold = 05;Match_Distance = 1000;