Skip to content

Commit eefa1ae

Browse files
committed
Fix incorrect count of empty cells
fix #197
1 parent 3e93edd commit eefa1ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ const chunk = (arr, n) =>
2424

2525
const prepareData = ({ data, numColumns, itemsPerRow }) => {
2626
const col = numColumns || itemsPerRow;
27-
const missing = data.length % col;
27+
const missing = (col - (data.length % col)) % col;
2828
return [
2929
...data,
30-
...Array.from(Array(col - missing)).map(() => ({ __empty: true }))
30+
...Array.from(Array(missing)).map(() => ({ __empty: true }))
3131
];
3232
};
3333

0 commit comments

Comments
 (0)