From 10aaabb3b7b22c8019dc74f0ab674041167e7438 Mon Sep 17 00:00:00 2001 From: bp-dev Date: Tue, 9 Jan 2018 14:18:30 -0500 Subject: [PATCH] Support patches with empty lines Code styling --- src/patch/apply.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/patch/apply.js b/src/patch/apply.js index 408b3049..7bbdb6d0 100644 --- a/src/patch/apply.js +++ b/src/patch/apply.js @@ -34,8 +34,8 @@ export function applyPatch(source, uniDiff, options = {}) { function hunkFits(hunk, toPos) { for (let j = 0; j < hunk.lines.length; j++) { let line = hunk.lines[j], - operation = line.length>0 ? line[0] : ' ', - content = line.length>0 ? line.substr(1) : line; + operation = (line.length > 0 ? line[0] : ' '), + content = (line.length > 0 ? line.substr(1) : line); if (operation === ' ' || operation === '-') { // Context sanity check @@ -91,8 +91,8 @@ export function applyPatch(source, uniDiff, options = {}) { for (let j = 0; j < hunk.lines.length; j++) { let line = hunk.lines[j], - operation = line.length>0 ? line[0] : ' ', - content = line.length>0 ? line.substr(1) : line, + operation = (line.length > 0 ? line[0] : ' '), + content = (line.length > 0 ? line.substr(1) : line), delimiter = hunk.linedelimiters[j]; if (operation === ' ') {