本文整理汇总了TypeScript中diff-match-patch.diff_match_patch.patch_fromText方法的典型用法代码示例。如果您正苦于以下问题:TypeScript diff_match_patch.patch_fromText方法的具体用法?TypeScript diff_match_patch.patch_fromText怎么用?TypeScript diff_match_patch.patch_fromText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类diff-match-patch.diff_match_patch
的用法示例。
在下文中一共展示了diff_match_patch.patch_fromText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: testPatchToText
function testPatchToText() {
const strp = '@@ -21,18 +22,17 @@\n jump\n-s\n+ed\n over \n-the\n+a\n laz\n';
const p = dmp.patch_fromText(strp);
assertEquals(strp, dmp.patch_toText(p));
}
示例2: testPatchAddContext
function testPatchAddContext() {
dmp.Patch_Margin = 4;
const p = dmp.patch_fromText('@@ -21,4 +21,10 @@\n-jump\n+somersault\n')[0];
dmp.patch_addContext_(p, 'The quick brown fox jumps over the lazy dog.');
assertEquals('@@ -17,12 +17,18 @@\n fox \n-jump\n+somersault\n s ov\n', p.toString());
}
示例3: testPatchFromText
function testPatchFromText() {
const strp = '@@ -21,18 +22,17 @@\n jump\n-s\n+ed\n over \n-the\n+a\n %0Alaz\n';
assertEquals(strp, dmp.patch_fromText(strp)[0].toString());
}