# All files / csv2json/libs/core filterRow.js

0% Statements 0/12
0% Branches 0/12
0% Functions 0/1
0% Lines 0/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19

     module.exports=function filterRow(row, param) {
      if (param.ignoreColumns instanceof Array && param.ignoreColumns.length > 0) {
        for (var igRow = 0, igColLen = param.ignoreColumns.length; igRow < igColLen; igRow++) {
          if (param.ignoreColumns[igRow] >= 0) {
            row.splice(param.ignoreColumns[igRow], 1);
          }
        }
      }
      if (param.includeColumns instanceof Array && param.includeColumns.length > 0) {
        var cleanRowArr = [];
        for (var inRow = 0, inColLen = param.includeColumns.length; inRow < inColLen; inRow++) {
          if (param.includeColumns[inRow] >= 0) {
            cleanRowArr.push(row[param.includeColumns[inRow]]);
          }
        }
        row = cleanRowArr;
      }
      return row;
    }