GitXplorerGitXplorer
j

diff-parse

public
4 stars
3 forks
1 issues

Commits

List of commits on branch master.
Unverified
ac23bc5955a891c3238d7a4c9cbada3fd1f19ad3

make this work for git diffs

jjonjonsonjr committed 11 years ago
Unverified
fbe5d27f2dbbd08921073f44793e26667fea7af9

Remove all coffeescript things

jjonjonsonjr committed 11 years ago
Unverified
f1ef0aa1d8b0a42eec3e595360961f48ac8af3dc

init

jjonjonsonjr committed 11 years ago

README

The README file for this repository.

diff-parse

Unified diff parser for nodejs

This is straight from parse-diff. I just compiled the coffeescript to javascript because coffeescript complicates things if you just want to use the module.

I also strip the first character for each line because I'm using this for git diffs. It was keeping the '+', '-', and ' ' before the text on each line.

JavaScript Usage Example

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