diff --git a/src/patch/create.js b/src/patch/create.js index 0dbd0c9d..0579e56f 100644 --- a/src/patch/create.js +++ b/src/patch/create.js @@ -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) {