/* global self, global, window */
function ifDefined(o) {
  return typeof o !== 'undefined' ? o : false;
}

var GlobalContext = ifDefined(self) || ifDefined(global) || ifDefined(window);

if (!GlobalContext) {
  throw new Error('no global: `self` nor `global` nor `window` was found');
}

export default GlobalContext;

var GlobalContext;

/* global self */
if (typeof self === 'object') {
  GlobalContext = self;

/* global global */
} else if (typeof global === 'object') {
  GlobalContext = global;

/* global window */
} else if (typeof window === 'object') {
  GlobalContext = window;
} else {
  throw new Error('no global: `self`, `global` nor `window` was found');
}

export default GlobalContext;

Fix ReferenceError in global context detection
[BUGFIX] Fix ReferenceError in global context detection

When undefined variable is referenced in global context detection,
it throws `ReferenceError`.
