index.js
function getGlobalExpression(state, filePath, name, opt_isWildcard) {
    assertFilenameRequired(state.file.opts.filename);
    var globalName = state.opts.globalName;
    var id;
    if (typeof globalName === 'function') {
        id = globalName(state, filePath, name, opt_isWildcard);
    }
    else {
      if (name || opt_isWildcard) {
        globalName += 'Named';
      }

      filePath = path.resolve(path.dirname(state.file.opts.filename), filePath);
      var splitPath = filePath.split(path.sep);
      var moduleName = splitPath[splitPath.length - 1];

      id = 'this.' + globalName + '.' + moduleName + (name && name !== true ? '.' + name : '');
    }

    var parts = id.split('.');
    var expr = t.identifier(parts[0]);
    for (var i = 1; i < parts.length; i++) {
      expr = t.memberExpression(expr, t.stringLiteral(parts[i]), true);
    }
    return expr;
  }
function getGlobalExpression(state, filePath, name, opt_isWildcard) {
    assertFilenameRequired(state.file.opts.filename);
    var globalName = state.opts.globalName;
    var id;
    if (typeof globalName === 'function') {
        id = globalName(state, filePath, name, opt_isWildcard);
    }
    else {
      if (name || opt_isWildcard) {
        globalName += 'Named';
      }

      filePath = path.resolve(path.dirname(state.file.opts.filename), filePath);
      var splitPath = filePath.split(path.sep);
      var moduleName = splitPath[splitPath.length - 1];

      id = 'this.' + globalName + '.' + moduleName + (name && name !== true ? '.' + name : '');
    }

    var parts = id.split('.');
    var expr = t.identifier(parts[0]);
    for (var i = 1; i < parts.length; i++) {
      expr = t.memberExpression(expr, t.stringLiteral(parts[i]), true);
    }
    return expr;
  }
function getGlobalExpression ( state , filePath , name , opt_isWildcard ) { assertFilenameRequired ( state . file . opts . filename ) ; var globalName = state . opts . globalName ; var id ; if ( typeof globalName === 'function' ) { id = globalName ( state , filePath , name , opt_isWildcard ) ; } else { if ( name || opt_isWildcard ) { globalName += 'Named' ; } filePath = path . resolve ( path . dirname ( state . file . opts . filename ) , filePath ) ; var splitPath = filePath . split ( path . sep ) ; var moduleName = splitPath [ splitPath . length - 1 ] ; id = 'this.' + globalName + '.' + moduleName + ( name && name !== true ? '.' + name : '' ) ; } var parts = id . split ( '.' ) ; var expr = t . identifier ( parts [ 0 ] ) ; for ( var i = 1 ; i < parts . length ; i ++ ) { expr = t . memberExpression ( expr , t . stringLiteral ( parts [ i ] ) , true ) ; } return expr ; }
Gets the global identifier for the given information.
@param {!Object} state This plugin's current state object.
@param {string} filePath The path of the module.
@param {?string} name The name of the variable being imported or exported from
the module.
@param {boolean=} opt_isWildcard If the import or export declaration is using a wildcard.
@return {!MemberExpression}
Gets the global identifier for the given information .