diffsplit

0.0.2 • Public • Published

diffsplit Build Status

diffsplit is a module for splitting diffs into chunks.

Installation

npm install diffsplit

Usage

var diffsplit = require('diffsplit');
var diff = [
  '@@ -1,6 +1,6 @@ Some heading.',
  ' This is a simple test file.',
  ' ',
  '-It has 10 paragraphs.',
  '+It has many paragraphs.',
  ' ',
  ' However, only few will be modified.',
  ' ',
  '@@ -14,7 +14,7 @@',
  ' ',
  ' It\'s just a simple demonstration of `diffsplit`, a simple and tiny library.',
  ' ',
  '-So, how about modifying this file yet? I really should be working on something',
  '-else instead.',
  '+So, how about modifying this file yet? I really should be working on `diffsplit`',
  '+itself.',
  ' ',
  ' It\'s getting too long.',
].join('\n');
console.dir(diffsplit(diff));

Output:

[ { original: { start: 1, length: 6 },
    new: { start: 1, length: 6 },
    heading: 'Some heading.',
    lines: 
     [ ' This is a simple test file.',
       ' ',
       '-It has 10 paragraphs.',
       '+It has many paragraphs.',
       ' ',
       ' However, only few will be modified.',
       ' ' ] },
  { original: { start: 14, length: 7 },
    new: { start: 14, length: 7 },
    heading: '',
    lines: 
     [ ' ',
       ' It\'s just a simple demonstration of `diffsplit`, a simple and tiny library.',
       ' ',
       '-So, how about modifying this file yet? I really should be working on something',
       '-else instead.',
       '+So, how about modifying this file yet? I really should be working on `diffsplit`',
       '+itself.',
       ' ',
       ' It\'s getting too long.' ] } ]

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i diffsplit

    Weekly Downloads

    2

    Version

    0.0.2

    License

    none

    Last publish

    Collaborators

    • mmalecki