Skip to content

Ignore whitespaces #20

Open
Open

Description

@suther

Please make an option to ignore whitespaces and tabs

Activity

  1. tbrugz commented on Apr 12, 2016

    @tbrugz

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions