How to use the esotope-hammerhead.Syntax.AssignmentPattern function in esotope-hammerhead

To help you get started, we’ve selected a few esotope-hammerhead examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DevExpress / testcafe-hammerhead / src / processing / script / transformers / location-get.ts View on Github external
condition: (node, parent) => {
        if (node.name !== 'location' || !parent)
            return false;

        // Skip: const location = value;
        if (parent.type === Syntax.VariableDeclarator && parent.id === node)
            return false;

        // Skip: location = value || function x (location = value) { ... }
        if ((parent.type === Syntax.AssignmentExpression || parent.type === Syntax.AssignmentPattern) &&
            parent.left === node)
            return false;

        // Skip: function location() {}
        if ((parent.type === Syntax.FunctionExpression || parent.type === Syntax.FunctionDeclaration) &&
            parent.id === node)
            return false;

        // Skip: object.location || location.field
        if (parent.type === Syntax.MemberExpression)
            return false;

        // Skip: { location: value }
        if (parent.type === Syntax.Property && parent.key === node)
            return false;
github DevExpress / testcafe-hammerhead / src / processing / script / transformers / eval-get.ts View on Github external
// Skip: function eval () { ... }
            if ((parent.type === Syntax.FunctionExpression || parent.type === Syntax.FunctionDeclaration) &&
                parent.id === node)
                return false;

            // Skip: function (eval) { ... } || function func(eval) { ... } || eval => { ... }
            if ((parent.type === Syntax.FunctionExpression || parent.type === Syntax.FunctionDeclaration ||
                 parent.type === Syntax.ArrowFunctionExpression) && parent.params.indexOf(node) !== -1)
                return false;

            // Skip: { eval: value }
            if (parent.type === Syntax.Property && parent.key === node)
                return false;

            // Skip: eval = value || function x (eval = value) { ... }
            if ((parent.type === Syntax.AssignmentExpression || parent.type === Syntax.AssignmentPattern) &&
                parent.left === node)
                return false;

            // Skip: const eval = value;
            if (parent.type === Syntax.VariableDeclarator && parent.id === node)
                return false;

            // Skip: eval++ || eval-- || ++eval || --eval
            if (parent.type === Syntax.UpdateExpression && (parent.operator === '++' || parent.operator === '--'))
                return false;

            // Skip already transformed: __get$Eval(eval)
            if (parent.type === Syntax.CallExpression && parent.callee.type === Syntax.Identifier &&
                parent.callee.name === INSTRUCTION.getEval)
                return false;
github DevExpress / testcafe-hammerhead / src / processing / script / transformers / post-message-get.ts View on Github external
// Skip: function postMessage () { ... }
        if ((parent.type === Syntax.FunctionExpression || parent.type === Syntax.FunctionDeclaration) &&
            parent.id === node)
            return false;

        // Skip: function (postMessage) { ... } || function func(postMessage) { ... } || postMessage => { ... }
        if ((parent.type === Syntax.FunctionExpression || parent.type === Syntax.FunctionDeclaration ||
             parent.type === Syntax.ArrowFunctionExpression) && parent.params.indexOf(node) !== -1)
            return false;

        // Skip: { postMessage: value }
        if (parent.type === Syntax.Property && parent.key === node)
            return false;

        // Skip: postMessage = value || function x (postMessage = value) { ... }
        if ((parent.type === Syntax.AssignmentExpression || parent.type === Syntax.AssignmentPattern) &&
            parent.left === node)
            return false;

        // Skip: const postMessage = value;
        if (parent.type === Syntax.VariableDeclarator && parent.id === node)
            return false;

        // Skip: postMessage++ || postMessage-- || ++postMessage || --postMessage
        if (parent.type === Syntax.UpdateExpression && (parent.operator === '++' || parent.operator === '--'))
            return false;

        // Skip already transformed: __get$PostMessage(postMessage) || __call$(obj, postMessage, args...);
        if (parent.type === Syntax.CallExpression && parent.callee.type === Syntax.Identifier &&
            (parent.callee.name === INSTRUCTION.getPostMessage ||
             parent.callee.name === INSTRUCTION.callMethod && parent.arguments[1] === node))
            return false;