How to use the esotope-hammerhead.Syntax.FunctionExpression 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 / node-builder.ts View on Github external
export function createLocationSetWrapper (value: Expression, wrapWithSequence: boolean): Expression {
    const tempIdentifier                 = createTempVarIdentifier();
    const locationIdentifier: Identifier = {
        type: Syntax.Identifier,
        name: 'location'
    };

    let wrapper: Expression = {
        type: Syntax.CallExpression,

        callee: {
            type:     Syntax.MemberExpression,
            computed: false,

            object: {
                type:   Syntax.FunctionExpression,
                id:     null,
                params: [],

                body: {
                    type: Syntax.BlockStatement,
                    body: [
                        createVarDeclaration(tempIdentifier, value),
                        {
                            type: Syntax.ReturnStatement,

                            argument: {
                                type:     Syntax.LogicalExpression,
                                operator: '||',

                                left: {
                                    type: Syntax.CallExpression,