Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

textdiff-patch

NPM version Dependency Status Build Status License Downloads

textdiff-patch

This is a simple module for applying lean text diff delta patches created by textdiff-create.

Usage

Assuming you've correctly installed the npm module with npm i textdiff-patch [--save|--save-dev]:

var applyPatch = require('textdiff-patch');

var v1 = 'The sleepy brown fox';
var delta = [
      [0, 4],
      [-1, 6],
      [1, 'quick'],
      [0, 10],
      [1, ' jumps over the lazy dog']
    ];

var v2 = applyPatch(v1, delta);

console.log(v2);

The script will produce the following output:

The quick brown fox jumps over the lazy dog

Additional info

Have a look at textdiff-create for more info.

Credits

If you find this piece of software useful, please star the repo, spread the word and feel free to endorse me on LinkedIn:

Ionut-Cristian Florescu on LinkedIn

LICENSE

Released under ISC.

About

Apply lean text diff delta patches created by textdiff-create.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published