nd
node-diff
npm i node-diff
nd

node-diff

Generates diff markup for two strings.

by Tim Savery

0.2.0 (see all)License:MITTypeScript:Not Found
npm i node-diff
Readme

node-diff

A port of John Resig's Javascript Diff Algorithm posted here: http://ejohn.org/projects/javascript-diff-algorithm

Installation

Installing node-diff

  $ [sudo] npm install node-diff

Usage

This module can be used to generate diff markup for two strings.

    var vows = require('vows')
      , diff = require('../diff')
      , assert = require('assert');
      
    vows.describe('Diff Tests').addBatch({
        'see that it works': {
            topic: function() {
                return diff(
                    'The red brown fox jumped over the rolling log.',
                    'The brown spotted fox leaped over the rolling log'
                );
            },
            'as expected': function(topic) {
                assert.equal(topic, ' The <del>red </del> brown <ins>spotted </ins> fox <del>jumped </del><ins>leaped </ins> over  the  rolling <del>log.\n</del><ins>log\n</ins>');
            }
        }
    }).export(module);

Author: Tim Savery

Downloads/wk

13

GitHub Stars

20

LAST COMMIT

9yrs ago

MAINTAINERS

1

CONTRIBUTORS

0

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
0.2.0
latest
10yrs ago
No alternatives found
No tutorials found
Add a tutorial