lib/rules/new-cap.js
function isCapAllowed(allowedMap, node, calleeName, pattern) {
            const sourceText = sourceCode.getText(node.callee);

            if (allowedMap[calleeName] || allowedMap[sourceText]) {
                return true;
            }

            if (pattern && pattern.test(sourceText)) {
                return true;
            }

            if (calleeName === "UTC" && node.callee.type === "MemberExpression") {

                // allow if callee is Date.UTC
                return node.callee.object.type === "Identifier" &&
                    node.callee.object.name === "Date";
            }

            return skipProperties && node.callee.type === "MemberExpression";
        }
function isCapAllowed(allowedMap, node, calleeName, pattern) {
            const sourceText = sourceCode.getText(node.callee);

            if (allowedMap[calleeName] || allowedMap[sourceText]) {
                return true;
            }

            if (pattern && pattern.test(sourceText)) {
                return true;
            }

            if (calleeName === "UTC" && node.callee.type === "MemberExpression") {

                // allow if callee is Date.UTC
                return node.callee.object.type === "Identifier" &&
                    node.callee.object.name === "Date";
            }

            return skipProperties && node.callee.type === "MemberExpression";
        }
function isCapAllowed ( allowedMap , node , calleeName , pattern ) { const sourceText = sourceCode . getText ( node . callee ) ; if ( allowedMap [ calleeName ] || allowedMap [ sourceText ] ) { return true ; } if ( pattern && pattern . test ( sourceText ) ) { return true ; } if ( calleeName === "UTC" && node . callee . type === "MemberExpression" ) { // allow if callee is Date.UTC return node . callee . object . type === "Identifier" && node . callee . object . name === "Date" ; } return skipProperties && node . callee . type === "MemberExpression" ; }
Check if capitalization is allowed for a CallExpression
@param {Object} allowedMap Object mapping calleeName to a Boolean
@param {ASTNode} node CallExpression node
@param {string} calleeName Capitalized callee name from a CallExpression
@param {Object} pattern RegExp object from options pattern
@returns {boolean} Returns true if the callee may be capitalized
Check if capitalization is allowed for a CallExpression