Skip to content

Commit

Permalink
adding comments about error
Browse files Browse the repository at this point in the history
  • Loading branch information
pat310 committed Apr 13, 2017
1 parent 9c8790d commit 812bc6a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/logic.js
Expand Up @@ -200,7 +200,10 @@ export function checkPivotCategories(actualCats, selectedCats) {
export function tableCreator(data, rows = [], cols = [], accCatOrCB,
accTypeOrInitVal, rowHeader) {

/** if data is empty, return empty array */
if (data.length === 0) return [];

/** if rows/cols are not arrays, return throw an error */
if (!Array.isArray(rows) || !Array.isArray(cols)) {
throw new Error('rowsToPivot and colsToPivot must be of type array');
}
Expand Down

0 comments on commit 812bc6a

Please sign in to comment.