Repository URL to install this package:
|
Version:
6.0.4 ▾
|
/* eslint no-confusing-arrow: "OFF" */
/* globals WorkerGlobalScope */
// import isBrowser from '../is/browser'
// import isNode from '../is/nodejs'
// import isWebWorker from '../is/webWorker'
/* prettier-ignore */
/**
* @TODO make function to better ensure we get the right global when we use it
* @since 5.0.0-beta.4
*
* @name localGlobal
* @memberOf util
*
* @return {Global}
*
* {@link https://github.com/jashkenas/underscore/blob/master/underscore.js#L11 underscore-root}
* {@link https://github.com/lodash/lodash/blob/master/.internal/root.js}
* @see {@link underscore-root}
* @see {@link lodash-root}
* @see is/browser
* @see is/webWorker
* @see is/nodejs
*
* @example localGlobal() //=> global
*
*/
export default = () =>
(
isBrowser()
? window
: isWebWorker()
? WorkerGlobalScope
: global
) || this
// typeof self === 'object' ? self
// https://github.com/facebook/regenerator/blob/master/packages/regenerator-runtime/runtime-module.js#L1
// Among the various tricks for obtaining a reference to the global
// object, this seems to be the most reliable technique that does not
// use indirect eval (which violates Content Security Policy).
// typeof global === "object" ? global :
// typeof window === "object" ? window :
// typeof self === "object" ? self : this