Property: function()

in rules/no-directive-replace.js [93:119]


            Property: function(node) {
                // This only checks for objects which have defined a literal restrict property.
                if (node.key.name !== 'replace') {
                    return;
                }
                if (ignoreReplaceFalse === true && node.value.value === false) {
                    return;
                }

                // assumption: Property always belongs to a ObjectExpression
                var objectExpressionParent = node.parent.parent;

                // add to potential replace nodes if the object is defined in a variable
                if (objectExpressionParent.type === 'VariableDeclarator') {
                    addPotentialReplaceNode(objectExpressionParent.id.name, node);
                }

                // report directly if object is part of a return statement and inside a directive body
                if (objectExpressionParent.type === 'ReturnStatement') {
                    addPotentialReplaceNode('', node);
                }

                // report directly if object is part of a arrow function and inside a directive body
                if (objectExpressionParent.type === 'ArrowFunctionExpression') {
                    addPotentialReplaceNode('', node);
                }
            }