All files / src/lib has-param.js

75% Statements 12/16
66.66% Branches 2/3
100% Functions 1/1
75% Lines 12/16

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 17193x 193x 193x 193x 193x 193x 193x 1544x 1544x 1544x 1544x         1544x  
/**
 * Check if a specific parameter exists in the command line arguments.
 * @param {string} param
 * @param {string} [paramValue]
 * @return {boolean}
 */
export function hasParam(param, paramValue) {
  const index = process.argv.indexOf(param);
  if (index === -1) {
    return false;
  }
  if (paramValue != null) {
    return process.argv[index + 1] === paramValue;
  }
  return true;
}