本文整理匯總了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());
}