Hi @icflorescu.
As discussions are not enabled for this repository, I hope you don't mind I create an issue to discuss this suggestion. It's not a huge optimization but since the goal of this library is to reduce the size of the output diff, wouldn't it be more efficient to flatten the output array and apply the following logic:
- DELETE === a negative number
- EQUAL === a positive number
- INSERT === a string
// fast-diff: 86 chars
[[0,"The "],[-1,"sleepy"],[1,"quick"],[0," brown fox"],[1," jumps over the lazy dog"]]
// textdiff-create: 64 chars
[[0,4],[-1,6],[1,"quick"],[0,10],[1," jumps over the lazy dog"]]
// proposal: 44 chars
[4,-6,"quick",10," jumps over the lazy dog"]
Hi @icflorescu.
As discussions are not enabled for this repository, I hope you don't mind I create an issue to discuss this suggestion. It's not a huge optimization but since the goal of this library is to reduce the size of the output diff, wouldn't it be more efficient to flatten the output array and apply the following logic: