Nurturing Pluto's Martians

    sdiff

    2.0.3 • Public • Published

    sdiff

    gets diff between two strings

    var sdiff = require('sdiff');
     
    var source = 'aaabbc';
    var target = 'aaajjc';
     
    var changes = sdiff.pull(source, target, { chunk: 1 }); 
     
    // changes  =
    //   [{
    //        start: 0,
    //        length: 3
    //    },
    //    {
    //        value: 'jj'
    //    },
    //    {
    //        start: 5,
    //        length: 1
    //    }];
     
    // send changes by network
     
    target === sdiff.push(source, changes); // true

    Keywords

    Install

    npm i sdiff

    DownloadsWeekly Downloads

    2

    Version

    2.0.3

    License

    MIT

    Last publish

    Collaborators

    • alexanderpo