index.js
function tryToCoverWindow(code) {

        if (typeof window === "object") {

            var variables = Object.getOwnPropertyNames(window);

            if (!window.hasOwnProperty('window')) {

                variables.push('window');

            }

            var stubDeclarations = '';
            variables.forEach(function(name) {

                // If the name really can be the name of variable.
                if (lodash.isString(name)) {

                    var stub = 'var ' + name + '; \n';

                    stubDeclarations = stubDeclarations + stub;

                }

            });

            code = stubDeclarations + code;

        }

        return code;

    }
function tryToCoverWindow(code) {

        if (typeof window === "object") {

            var variables = Object.getOwnPropertyNames(window);

            if (!window.hasOwnProperty('window')) {

                variables.push('window');

            }

            var stubDeclarations = '';
            variables.forEach(function(name) {

                // If the name really can be the name of variable.
                if (lodash.isString(name)) {

                    var stub = 'var ' + name + '; \n';

                    stubDeclarations = stubDeclarations + stub;

                }

            });

            code = stubDeclarations + code;

        }

        return code;

    }
function tryToCoverWindow ( code ) { if ( typeof window === "object" ) { var variables = Object . getOwnPropertyNames ( window ) ; if ( ! window . hasOwnProperty ( 'window' ) ) { variables . push ( 'window' ) ; } var stubDeclarations = '' ; variables . forEach ( function ( name ) { // If the name really can be the name of variable. if ( lodash . isString ( name ) ) { var stub = 'var ' + name + '; \n' ; stubDeclarations = stubDeclarations + stub ; } } ) ; code = stubDeclarations + code ; } return code ; }
Makes stubs of variables for avoid the changing of outside environment which has these variables too.

TODO need to take this function into a separate module.

@private
@param {String} code The source code.
Makes stubs of variables for avoid the changing of outside environment which has these variables too .