npm

Join us for the upcoming webinar, "Enterprise JavaScript done right: the tools you love, the security you need."Sign up here »

parse-diff

0.4.0 • Public • Published

Built with Grunt Build Status DevDeps Status Total downloads

NPM

parse-diff

Simple unified diff parser for nodejs

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
});

install

npm i parse-diff

Downloadsweekly downloads

109,033

version

0.4.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability