lib/rules/comma-dangle.js
function getLastItem(node) {
            switch (node.type) {
                case "ObjectExpression":
                case "ObjectPattern":
                    return lodash.last(node.properties);
                case "ArrayExpression":
                case "ArrayPattern":
                    return lodash.last(node.elements);
                case "ImportDeclaration":
                case "ExportNamedDeclaration":
                    return lodash.last(node.specifiers);
                case "FunctionDeclaration":
                case "FunctionExpression":
                case "ArrowFunctionExpression":
                    return lodash.last(node.params);
                case "CallExpression":
                case "NewExpression":
                    return lodash.last(node.arguments);
                default:
                    return null;
            }
        }
function getLastItem(node) {
            switch (node.type) {
                case "ObjectExpression":
                case "ObjectPattern":
                    return lodash.last(node.properties);
                case "ArrayExpression":
                case "ArrayPattern":
                    return lodash.last(node.elements);
                case "ImportDeclaration":
                case "ExportNamedDeclaration":
                    return lodash.last(node.specifiers);
                case "FunctionDeclaration":
                case "FunctionExpression":
                case "ArrowFunctionExpression":
                    return lodash.last(node.params);
                case "CallExpression":
                case "NewExpression":
                    return lodash.last(node.arguments);
                default:
                    return null;
            }
        }
function getLastItem ( node ) { switch ( node . type ) { case "ObjectExpression" : case "ObjectPattern" : return lodash . last ( node . properties ) ; case "ArrayExpression" : case "ArrayPattern" : return lodash . last ( node . elements ) ; case "ImportDeclaration" : case "ExportNamedDeclaration" : return lodash . last ( node . specifiers ) ; case "FunctionDeclaration" : case "FunctionExpression" : case "ArrowFunctionExpression" : return lodash . last ( node . params ) ; case "CallExpression" : case "NewExpression" : return lodash . last ( node . arguments ) ; default : return null ; } }
Gets the last item of the given node.
@param {ASTNode} node - The node to get.
@returns {ASTNode|null} The last node or null.
Gets the last item of the given node .