Skip to content

Any option not to catch unbreakable space? #174

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

Closed
kud opened this issue Apr 19, 2017 · 1 comment
Closed

Any option not to catch unbreakable space? #174

kud opened this issue Apr 19, 2017 · 1 comment
Labels

Comments

@kud
Copy link

kud commented Apr 19, 2017

Hello,

I'm using wordsWithSpace function to make the diff but I'd like not to catch unbreakable spaces. Is there any option to do that?

For the moment I do this:

    /* remove unbreakable space */
    const original = this.props.original.replace(/ /gi, ' ')
    const changed = this.props.changed.replace(/ /gi, ' ')

    const differential = diffFnMap[this.props.type](original, changed)
@ExplodingCabbage
Copy link
Collaborator

As in, you'd like a version of diffWordsWithSpace that treats whitespace changes as changes except for changes where spaces are converted to non-breaking spaces, or vice versa, in which case you want the strings to be treated as identical?

There's of course no option specifically for that highly specific task, nor would I want to add one. But you could in principle do this by extending wordDiff with a tweaked equals method. We don't have got docs on defining custom differs right now, but we've got an issue to add such docs (#149) which I'll get to at some point.

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

No branches or pull requests

2 participants