JSPM

  • Created
  • Published
  • Downloads 1356565
  • Score
    100M100P100Q196587F
  • License MIT

Unified diff parser

Package Exports

  • parse-diff
  • parse-diff/index.js

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 (parse-diff) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Build Status Total downloads

NPM

parse-diff

Simple unified diff parser for JavaScript

JavaScript Usage Example

var parse = require('parse-diff');
var diff = ''; // input diff string
var files = parse(diff);
console.log(files.length); // number of patched files
files.forEach(function(file) {
    console.log(file.chunks.length); // number of hunks
    console.log(file.chunks[0].changes.length) // hunk added/deleted/context lines
    // each item in changes is a string
    console.log(file.deletions); // number of deletions in the patch
    console.log(file.additions); // number of additions in the patch
});