lib/rules/no-unused-vars.js
function getFunctionDefinitions(variable) {
            const functionDefinitions = [];

            variable.defs.forEach(def => {
                const { type, node } = def;

                // FunctionDeclarations
                if (type === "FunctionName") {
                    functionDefinitions.push(node);
                }

                // FunctionExpressions
                if (type === "Variable" && node.init &&
                    (node.init.type === "FunctionExpression" || node.init.type === "ArrowFunctionExpression")) {
                    functionDefinitions.push(node.init);
                }
            });
            return functionDefinitions;
        }
function getFunctionDefinitions(variable) {
            const functionDefinitions = [];

            variable.defs.forEach(def => {
                const { type, node } = def;

                // FunctionDeclarations
                if (type === "FunctionName") {
                    functionDefinitions.push(node);
                }

                // FunctionExpressions
                if (type === "Variable" && node.init &&
                    (node.init.type === "FunctionExpression" || node.init.type === "ArrowFunctionExpression")) {
                    functionDefinitions.push(node.init);
                }
            });
            return functionDefinitions;
        }
function getFunctionDefinitions ( variable ) { const functionDefinitions = [ ] ; variable . defs . forEach ( def => { const { type , node } = def ; // FunctionDeclarations if ( type === "FunctionName" ) { functionDefinitions . push ( node ) ; } // FunctionExpressions if ( type === "Variable" && node . init && ( node . init . type === "FunctionExpression" || node . init . type === "ArrowFunctionExpression" ) ) { functionDefinitions . push ( node . init ) ; } } ) ; return functionDefinitions ; }
Gets a list of function definitions for a specified variable.
@param {Variable} variable - eslint-scope variable object.
@returns {ASTNode[]} Function nodes.
@private
Gets a list of function definitions for a specified variable .