1
0
Fork 0
mirror of https://github.com/gorhill/uMatrix.git synced 2024-05-19 19:53:19 +12:00
uMatrix/src/lib/diff
2018-03-22 15:56:37 -04:00
..
README.md integrate CodeMirror's MergeView to the 'My rules' pane 2018-03-22 15:56:37 -04:00
swatinem_diff.js integrate CodeMirror's MergeView to the 'My rules' pane 2018-03-22 15:56:37 -04:00

diff

implementation of myers diff algorithm

Build Status Coverage Status Dependency Status

This uses the An O(ND) Difference Algorithm and Its Variations Also see http://simplygenius.net/Article/DiffTutorial2 and http://www.mathertel.de/Diff/ViewSrc.aspx for more inspiration

Installation

$ npm install diff
$ component install Swatinem/diff

Usage

diff(a, b, [eql(a, b)])

Given two arrays (or array-likes, such as strings) a and b and an optional equal function eql, this will return an array with the following operations:

  • nop the element is in both arrays
  • ins the element is only in array b and will be inserted
  • del the element in only in array a and will be removed
  • rep the element from a will be replaced by the element from b. This is essentially the same as a del+ins

License

LGPLv3