parse-diff

Unified diff parser for nodejs and browser

MIT License

Downloads
3.3M
Stars
87
Committers
15

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
});
Package Rankings
Top 1.85% on Npmjs.org
Badges
Extracted from project README
Build Status Total downloads NPM