all files / src/rules/ private-valid-values.js

100% Statements 14/14
100% Branches 2/2
100% Functions 1/1
100% Lines 14/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28                           
"use strict";
 
const LintIssue = require("./../LintIssue");
const isValidValue = require("./../validators/valid-values").isValidValue;
const lintId = "private-valid-values";
const lintType = "error";
const nodeName = "private";
const message = "Invalid value for private";
const ruleType = "valid-values";
 
/**
 * [function description]
 * @param  {Object}   packageJsonData   Valid package.json object
 * @param  {Array}    validValues       An array of valid values
 * @return {Object|Boolean}             LintIssue object if invalid. True if valid
 */
const lint = function(packageJsonData, validValues) {
  if (!isValidValue(packageJsonData, nodeName, validValues)) {
    return new LintIssue(lintId, lintType, nodeName, message);
  }
 
  return true;
};
 
module.exports.lint = lint;
module.exports.lintType = lintType;
module.exports.ruleType = ruleType;