diff-delta
Converts a generic-diff diff into a series of add/update/remove deltas.
Installation
$ npm install --save diff-delta
Example
var diff = var delta = var d = console
The above code logs the following:
Each item in the array represents a delta, with an index at which to apply the delta assuming all previous deltas have been applied. The above sequences of deltas can thus be interpreted as:
- Start with the original string,
falafel dreams
- Remove 3 items,
afe
, starting at index 3:fall dreams
- Add
acy
at index 4:fallacy dreams
- Replace 1 item at index 8 with
m
:fallacy mreams
- Remove 1 item,
m
, at index 9:fallacy meams
- Replace 1 item at index 11 with
n
:fallacy means
License
MIT.