Skip to content

Commit a130776

Browse files
authored
Merge pull request #19 from happo/pad-bottom
Conditionally pad images of different height
2 parents e9e0ba6 + 06f3bc8 commit a130776

File tree

8 files changed

+9
-1
lines changed

8 files changed

+9
-1
lines changed

snapshots/long-example/diff.png

373 KB
Loading
12 KB
Loading
14 KB
Loading
14.5 KB
Loading
1.36 KB
Loading
1.62 KB
Loading
639 Bytes
Loading

src/alignArrays.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,15 @@ function applySolution(solution, a, b) {
116116
const aLength = a.length;
117117
const bLength = b.length;
118118
const shorterArray = aLength > bLength ? b : a;
119-
shorterArray.splice(0, 0, ...placeholders(Math.abs(aLength - bLength)));
119+
if (a[0] === b[0]) {
120+
shorterArray.splice(
121+
shorterArray.length - 1,
122+
0,
123+
...placeholders(Math.abs(aLength - bLength)),
124+
);
125+
} else {
126+
shorterArray.splice(0, 0, ...placeholders(Math.abs(aLength - bLength)));
127+
}
120128
}
121129

122130
/**

0 commit comments

Comments
 (0)