tools/eslint-rules/required-modules.js
function getRequiredModuleName(node) {
    var moduleName;

    // node has arguments and first argument is string
    if (node.arguments.length && isString(node.arguments[0])) {
      var argValue = path.basename(node.arguments[0].value.trim());

      // check if value is in required modules array
      if (requiredModules.indexOf(argValue) !== -1) {
        moduleName = argValue;
      }
    }

    return moduleName;
  }
function getRequiredModuleName(node) {
    var moduleName;

    // node has arguments and first argument is string
    if (node.arguments.length && isString(node.arguments[0])) {
      var argValue = path.basename(node.arguments[0].value.trim());

      // check if value is in required modules array
      if (requiredModules.indexOf(argValue) !== -1) {
        moduleName = argValue;
      }
    }

    return moduleName;
  }
function getRequiredModuleName ( node ) { var moduleName ; // node has arguments and first argument is string if ( node . arguments . length && isString ( node . arguments [ 0 ] ) ) { var argValue = path . basename ( node . arguments [ 0 ] . value . trim ( ) ) ; // check if value is in required modules array if ( requiredModules . indexOf ( argValue ) !== - 1 ) { moduleName = argValue ; } } return moduleName ; }
Function to check if a node has an argument that is a required module and
return its name.
@param {ASTNode} node The node to check
@returns {undefined|String} required module name or undefined
Function to check if a node has an argument that is a required module and return its name .