slightly optimize two way merge
This commit is contained in:
parent
7228398d0a
commit
f256936bae
@ -73,6 +73,18 @@ function getLCSText(a: string, b: string) {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
function twoWayMerge(a: string, b: string): string {
|
function twoWayMerge(a: string, b: string): string {
|
||||||
|
const aa = a.trim();
|
||||||
|
const bb = b.trim();
|
||||||
|
if (aa === "" && bb === "") {
|
||||||
|
return aa.length >= bb.length ? a : b;
|
||||||
|
}
|
||||||
|
if (bb === "") {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
if (aa === "") {
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
// const c = getLCSText(a, b);
|
// const c = getLCSText(a, b);
|
||||||
// const patches = makePatches(c, a);
|
// const patches = makePatches(c, a);
|
||||||
// const [d] = applyPatches(patches, b);
|
// const [d] = applyPatches(patches, b);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user