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

Ignore whitespaces #20

Open
suther opened this issue Oct 8, 2015 · 1 comment
Open

Ignore whitespaces #20

suther opened this issue Oct 8, 2015 · 1 comment

Comments

@suther
Copy link

suther commented Oct 8, 2015

Please make an option to ignore whitespaces and tabs

@tbrugz
Copy link

tbrugz commented Apr 12, 2016

@suther You may remove whitespaces before calling difflib.SequenceMatcher - with this function you can remove trailing whitespaces:

removeTrailingWhitespace = function(txt) {
    var pattern = /\s*$/g;
    var newtxt = [];
    for(var i=0;i<txt.length;i++) {
        newtxt.push(txt[i].replace(pattern, ''));
    }
    return newtxt;
}

var base = removeTrailingWhitespace( difflib.stringAsLines(basetxt) );
var new = removeTrailingWhitespace( difflib.stringAsLines(newtxt) );

var sm = new difflib.SequenceMatcher(base, new);
(...)

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

2 participants