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

diffChars case insensitive #128

Closed
thomasdebruin opened this issue Aug 12, 2016 · 3 comments
Closed

diffChars case insensitive #128

thomasdebruin opened this issue Aug 12, 2016 · 3 comments

Comments

@thomasdebruin
Copy link

Is there a way to do a caseless insensitive compare with diffChars? And in the result use either the case from oldStr or newStr when it comes to matches?

Right now I'm, thinking of lowercasing both oldStr & newStr before calling diffChars. Then when iterating on the output: find the original string (not lowecased) in the user input for the matches.
But this could probably result in unpredictable outcome when certain matches occur multiple times with different case.

Other approach could be to modify the plugin, and lowercase on the point where the comparing is done wothout modifying the case of what's returned. But the code looks pretty complex, but I will give it a try.

@cupa
Copy link

cupa commented Oct 19, 2016

Any updates on this?

@thomasdebruin
Copy link
Author

The code is of the plugin is not that complex. I made a custom extend of the base.js, more or less the same as the character.js. Then overwrite the 'equals' function with a lowercase compare, so it's very simple.

@ExplodingCabbage
Copy link
Collaborator

Resolved by the addition of an ignoreCase option.

(I have some ideas on ways it might make sense to tweak that option, both for consistency with ignoreWhitespace and also to allow the user to get EITHER the old or new text from each change object, but those are already the topic of #219, so I figure I can still go ahead and close this.)

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

No branches or pull requests

3 participants