Permalink
Browse files

Make oldHeader and newHeader optional

    createPatch(fileName, oldStr, newStr, oldHeader, newHeader)

The last two arguments should be optional.
  • Loading branch information...
1 parent 01da667 commit 645e868230993d43778bf528be2fb76d2bcc6303 @NV NV committed Oct 9, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 diff.js
View
4 diff.js
@@ -187,8 +187,8 @@ var JsDiff = (function() {
ret.push("Index: " + fileName);
ret.push("===================================================================");
- ret.push("--- " + fileName + "\t" + oldHeader);
- ret.push("+++ " + fileName + "\t" + newHeader);
+ ret.push("--- " + fileName + (typeof oldHeader === "undefined" ? "" : "\t" + oldHeader));
+ ret.push("+++ " + fileName + (typeof newHeader === "undefined" ? "" : "\t" + newHeader));
var diff = LineDiff.diff(oldStr, newStr);
diff.push({value: "", lines: []}); // Append an empty value to make cleanup easier

0 comments on commit 645e868

Please sign in to comment.