Skip to content

different is a node module for parsing diffs from url or file

Notifications You must be signed in to change notification settings

jennazee/different

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

different

different is a node module for parsing git diff from a url or file into an array of JavaScript objects each representing changed files.

Installation

From NPM:

npm install different

From GitHub:

cd path/to/node_modules
git clone git://github.com/jennazee/different.git
cd different
npm install .

Usage

var different = require('different');

//parse diff from URL with options
different.parseDiff({url: 'https://github.com/jennazee/different/commit/6b7c205aa17e70f4958e8a7c20fccac8318480ff.diff'}, function(diff) {console.log(diff)});

//parse diff from file with options
different.parseDiff({fileName: 'path/to/diff.diff'}, function(diff) {console.log(diff)});

//parse diff straight from url
different.parseDiffFromUrl('https://github.com/jennazee/different/commit/6b7c205aa17e70f4958e8a7c20fccac8318480ff.diff', function(diff) {console.log(diff)});

//parse diff straight from file
different.parseDiff('path/to/diff.diff', function(diff) {console.log(diff)});

Example Array Output

[ {
    additions:
     [ 'Installation',
       '---',
       'From NPM:',
       'npm install different',
       'From GitHub:',
       'cd path/to/node_modules',
       'git clone git://github.com/jennazee/different.git',
       'cd different',
       'npm install .',
       'Usage',
       '---',
       '//diff from URL',
       '//diff from file',
       'different.parseDiff({fileName: \'path/to/diff.diff\'}, function(diff) {console.log(diff)});' ],
    deletions: [ 'How to use', '--------------' ],
    fileExtension: 'md',
    a: 'README.md',
    b: 'README.md'
  },
  {
    additions: [ '"version": "0.1.2",', '"main": "different.js",' ],
    deletions: [ '"version": "0.1.1",' ],
    fileExtension: 'json',
    a: 'package.json',
    b: 'package.json'
  }
]

About

different is a node module for parsing diffs from url or file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published