Skip to content

Commit

Permalink
Fix incorrect count of empty cells
Browse files Browse the repository at this point in the history
fix #197
  • Loading branch information
phil-r committed Nov 15, 2019
1 parent 3e93edd commit eefa1ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ const chunk = (arr, n) =>

const prepareData = ({ data, numColumns, itemsPerRow }) => {
const col = numColumns || itemsPerRow;
const missing = data.length % col;
const missing = (col - (data.length % col)) % col;
return [
...data,
...Array.from(Array(col - missing)).map(() => ({ __empty: true }))
...Array.from(Array(missing)).map(() => ({ __empty: true }))
];
};

Expand Down

0 comments on commit eefa1ae

Please sign in to comment.