Handle case where the user explicitly passes maxEditLength: 0
the way you'd expect
#464
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, this was treated as if the
maxEditLength
option wasn't provided at all, which seems surprising. Obviously, passingmaxEditLength: 0
isn't usually gonna be a very useful thing to do, but you can imagine a system where there's a configurable max edit distance between two texts with a UI that lets you put it all the way down to 0, and jsdiff is being used both to check that the max distance is being adhered to and to display the diff. In such a case, the current behaviour would introduce a surprising bug in themaxEditLength: 0
case.This PR makes jsdiff instead treat
maxEditLength: 0
as specifying a max edit length of 0.