Skip to content

Flip added and removed order? #14

@jacobsandlund

Description

@jacobsandlund

I'm wondering if it would make sense to flip the order in which added vs removed change objects get returned diffLines. This would make it easier to make a "git-like" diff without having to swap the added and removed semantics.

This is what I'm doing right now for Vaccine:

var chunks = jsdiff.diffLines(next, old).map(function(d) {
  if (d.removed) {
    return '<span class="added">' + prepend(d.value, '+') + '</span>';
  } else if (d.added) {
    return '<span class="removed">' + prepend(d.value, '-') + '</span>';
  } else {
    return prepend(d.value, ' ');
  }
});
return chunks.join('\n');

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