Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluate 'chardiff' module as replacement for 'dif' #1

Open
Bartvds opened this issue Jan 27, 2014 · 2 comments
Open

Evaluate 'chardiff' module as replacement for 'dif' #1

Bartvds opened this issue Jan 27, 2014 · 2 comments

Comments

@Bartvds
Copy link
Owner

Bartvds commented Jan 27, 2014

Does slightly better with line-based content (still fragments individual characters, but less then current diff?)

https://npmjs.org/package/chardiff

@alexbepple
Copy link

For me, the litmus test is the diff of "foo" and "ffoo". 😉 And based on this, Neil Fraser’s diff-match-patch would be my favorite.

diff-match-patch only needs two change objects. Whereas diff and chardiff produce essentially the same result, that comprises three change objects.

diff-match-patch (NPM package):

[ [ 1, 'f' ],
  [ 0, 'foo' ] ]

diff:

[ { count: 1, value: 'f' },
  { count: 1,
    added: true,
    removed: undefined,
    value: 'f' },
  { count: 2, value: 'oo' } ]

chardiff:

[ { type: '=', value: 'f' },
  { type: '+', right: 'f' },
  { type: '=', value: 'oo' } ]

@alexbepple
Copy link

Would you be interested in a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants