JSPM

node-diff

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 18
  • Score
    100M100P100Q49247F
  • License MIT

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

Package Exports

  • node-diff

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-diff) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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.</del><ins>log</ins>');
            }
        }
    }).export(module);

Author: Tim Savery