1.0.3 • Published 7 years ago

input-diff v1.0.3

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
7 years ago

input-diff Build Status Coverage Status

When text input changes, the following premises are usually true:

  • If the new text is longer than the old, it means something was inserted
  • If the new text is shorter than the old, it means something was removed

input-diff finds the LCS when those premises are met, and a valid diff when they're not, with few iterations.

Sample usage

var diff = require('input-diff'),
    data;

data = diff.get('Hello','Hello world');
console.log( diff.apply('Hello',data) ); // Hello world