Skip to content

Commit

Permalink
feat(structuredPatch): Pass options to diffLines
Browse files Browse the repository at this point in the history
Simply allow the user to use diffLines options with the structuredPatch
function
  • Loading branch information
Kiougar committed Dec 2, 2016
1 parent 870aa15 commit 663cd3f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/patch/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import {diffLines} from '../diff/line';

export function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
if (!options) {
options = { context: 4 };
options = {};
}
if (typeof options.context === 'undefined') {
options.context = 4;
}

const diff = diffLines(oldStr, newStr);
const diff = diffLines(oldStr, newStr, options);
diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier

function contextLines(lines) {
Expand Down

0 comments on commit 663cd3f

Please sign in to comment.