Skip to content

Commit

Permalink
find instead of filter
Browse files Browse the repository at this point in the history
  • Loading branch information
straker committed Jun 27, 2019
1 parent 17aaede commit 6a0663f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib/checks/tables/th-has-data-cells.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,16 @@ headers.forEach(header => {
// ensure column header has at least 1 non-header cell
let hasCell = false;
if (tableUtils.isColumnHeader(header)) {
hasCell =
tableUtils
.traverse('down', pos, tableGrid)
.filter(cell => !tableUtils.isColumnHeader(cell)).length !== 0;
hasCell = tableUtils
.traverse('down', pos, tableGrid)
.find(cell => !tableUtils.isColumnHeader(cell));
}

// ensure row header has at least 1 non-header cell
if (!hasCell && tableUtils.isRowHeader(header)) {
hasCell =
tableUtils
.traverse('right', pos, tableGrid)
.filter(cell => !tableUtils.isRowHeader(cell)).length !== 0;
hasCell = tableUtils
.traverse('right', pos, tableGrid)
.find(cell => !tableUtils.isRowHeader(cell));
}

// report the node as having failed
Expand Down

0 comments on commit 6a0663f

Please sign in to comment.