{"_id":"globalthis","_rev":"3341750","name":"globalthis","description":"ECMAScript spec-compliant polyfill/shim for `globalThis`","dist-tags":{"latest":"1.0.4"},"maintainers":[{"name":"ljharb","email":""}],"time":{"modified":"2024-07-10T08:35:09.000Z","created":"2018-08-10T07:36:45.922Z","1.0.4":"2024-04-30T02:35:59.115Z","1.0.3":"2022-05-07T15:51:20.810Z","1.0.2":"2021-02-22T18:45:25.242Z","1.0.1":"2019-12-15T17:51:36.683Z","1.0.0":"2018-08-10T07:36:45.922Z"},"users":{},"author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"repository":{"type":"git","url":"git://github.com/ljharb/System.global.git"},"versions":{"1.0.4":{"name":"globalthis","version":"1.0.4","author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"funding":{"url":"https://github.com/sponsors/ljharb"},"description":"ECMAScript spec-compliant polyfill/shim for `globalThis`","license":"MIT","main":"index.js","browser":{"./implementation":"./implementation.browser.js"},"scripts":{"prepack":"npmignore --auto --commentLines=autogenerated","prepublishOnly":"safe-publish-latest && npm run build","prepublish":"not-in-publish || npm run prepublishOnly","pretest":"npm run lint","test":"npm run --silent tests-only","posttest":"aud --production","tests-only":"nyc tape 'test/**/*.js'","lint":"eslint --ext=js,mjs .","postlint":"es-shim-api --bound --property","build":"mkdir -p dist && browserify browserShim.js > dist/browser.js","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"repository":{"type":"git","url":"git://github.com/ljharb/System.global.git"},"keywords":["window","self","global","globalThis","System.global","global object","global this value","ECMAScript","es-shim API","polyfill","shim"],"dependencies":{"define-properties":"^1.2.1","gopd":"^1.0.1"},"devDependencies":{"@es-shims/api":"^2.5.0","@ljharb/eslint-config":"^21.1.0","aud":"^2.0.4","auto-changelog":"^2.4.0","browserify":"^16.5.2","eslint":"=8.8.0","for-each":"^0.3.3","in-publish":"^2.0.1","is":"^3.3.0","npmignore":"^0.3.1","nyc":"^10.3.2","safe-publish-latest":"^2.0.0","tape":"^5.7.5"},"testling":{"files":"test/index.js","browsers":["iexplore/6.0..latest","firefox/3.0..6.0","firefox/15.0..latest","firefox/nightly","chrome/4.0..10.0","chrome/20.0..latest","chrome/canary","opera/10.0..latest","opera/next","safari/4.0..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2"]},"engines":{"node":">= 0.4"},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false,"hideCredit":true},"publishConfig":{"ignore":["browserShim.js",".github/workflows"]},"_id":"globalthis@1.0.4","gitHead":"ac7b854ca44994583a71a5de17dd73a70e8beeb4","bugs":{"url":"https://github.com/ljharb/System.global/issues"},"homepage":"https://github.com/ljharb/System.global#readme","_nodeVersion":"22.0.0","_npmVersion":"10.5.1","dist":{"shasum":"7430ed3a975d97bfb59bcce41f5cabbafa651236","size":8504,"noattachment":false,"key":"/globalthis/-/globalthis-1.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/globalthis/download/globalthis-1.0.4.tgz"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"maintainers":[{"name":"ljharb","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/globalthis_1.0.4_1714444558892_0.7093046903349614"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-04-30T02:35:59.115Z","publish_time":1714444559115,"_source_registry_name":"default","_cnpm_publish_time":1714444559115},"1.0.3":{"name":"globalthis","version":"1.0.3","author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"funding":{"url":"https://github.com/sponsors/ljharb"},"description":"ECMAScript spec-compliant polyfill/shim for `globalThis`","license":"MIT","main":"index.js","browser":{"./implementation":"./implementation.browser.js"},"scripts":{"prepack":"npmignore --auto --commentLines=autogenerated","prepublishOnly":"safe-publish-latest && npm run build","prepublish":"not-in-publish || npm run prepublishOnly","pretest":"npm run lint","test":"npm run --silent tests-only","posttest":"aud --production","tests-only":"nyc tape 'test/**/*.js'","lint":"eslint --ext=js,mjs .","postlint":"es-shim-api --bound --property","build":"mkdir -p dist && browserify browserShim.js > dist/browser.js","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"repository":{"type":"git","url":"git://github.com/ljharb/System.global.git"},"keywords":["window","self","global","globalThis","System.global","global object","global this value","ECMAScript","es-shim API","polyfill","shim"],"dependencies":{"define-properties":"^1.1.3"},"devDependencies":{"@es-shims/api":"^2.2.3","@ljharb/eslint-config":"^21.0.0","aud":"^2.0.0","auto-changelog":"^2.4.0","browserify":"^16.5.2","eslint":"=8.8.0","for-each":"^0.3.3","in-publish":"^2.0.1","is":"^3.3.0","nyc":"^10.3.2","safe-publish-latest":"^2.0.0","tape":"^5.5.3"},"testling":{"files":"test/index.js","browsers":["iexplore/6.0..latest","firefox/3.0..6.0","firefox/15.0..latest","firefox/nightly","chrome/4.0..10.0","chrome/20.0..latest","chrome/canary","opera/10.0..latest","opera/next","safari/4.0..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2"]},"engines":{"node":">= 0.4"},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false,"hideCredit":true},"publishConfig":{"ignore":["browserShim.js",".github/workflows"]},"gitHead":"8bc4bb4c715f89390fe083f2e2ed277474775972","bugs":{"url":"https://github.com/ljharb/System.global/issues"},"homepage":"https://github.com/ljharb/System.global#readme","_id":"globalthis@1.0.3","_nodeVersion":"18.0.0","_npmVersion":"8.3.1","dist":{"shasum":"5852882a52b80dc301b0660273e1ed082f0b6ccf","size":8108,"noattachment":false,"key":"/globalthis/-/globalthis-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/globalthis/download/globalthis-1.0.3.tgz"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"maintainers":[{"name":"ljharb","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/globalthis_1.0.3_1651938680679_0.6455229664483892"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-05-07T15:51:27.035Z","publish_time":1651938680810,"_cnpm_publish_time":1651938680810},"1.0.2":{"name":"globalthis","version":"1.0.2","author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"funding":{"url":"https://github.com/sponsors/ljharb"},"description":"ECMAScript spec-compliant polyfill/shim for `globalThis`","license":"MIT","main":"index.js","browser":{"./implementation":"./implementation.browser.js"},"scripts":{"prepublish":"safe-publish-latest && (not-in-publish || npm run --silent build)","pretest":"npm run lint","test":"npm run --silent tests-only","posttest":"npx aud --production","tests-only":"nyc tape 'test/**/*.js'","lint":"eslint .","postlint":"es-shim-api --bound --property","build":"mkdir -p dist && browserify browserShim.js > dist/browser.js","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"repository":{"type":"git","url":"git://github.com/ljharb/System.global.git"},"keywords":["window","self","global","globalThis","System.global","global object","global this value","ECMAScript","es-shim API","polyfill","shim"],"dependencies":{"define-properties":"^1.1.3"},"devDependencies":{"@es-shims/api":"^2.1.2","@ljharb/eslint-config":"^17.5.1","aud":"^1.1.4","auto-changelog":"^2.2.1","browserify":"^16.5.2","eslint":"^7.20.0","for-each":"^0.3.3","in-publish":"^2.0.1","is":"^3.3.0","nyc":"^10.3.2","safe-publish-latest":"^1.1.4","tape":"^5.2.0"},"testling":{"files":"test/index.js","browsers":["iexplore/6.0..latest","firefox/3.0..6.0","firefox/15.0..latest","firefox/nightly","chrome/4.0..10.0","chrome/20.0..latest","chrome/canary","opera/10.0..latest","opera/next","safari/4.0..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2"]},"engines":{"node":">= 0.4"},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false,"hideCredit":true},"gitHead":"0aa16d5fa8ba9b97058960fe98f56d55573f085b","bugs":{"url":"https://github.com/ljharb/System.global/issues"},"homepage":"https://github.com/ljharb/System.global#readme","_id":"globalthis@1.0.2","_nodeVersion":"15.8.0","_npmVersion":"7.5.4","dist":{"shasum":"2a235d34f4d8036219f7e34929b5de9e18166b8b","size":14159,"noattachment":false,"key":"/globalthis/-/globalthis-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/globalthis/download/globalthis-1.0.2.tgz"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"maintainers":[{"name":"ljharb","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/globalthis_1.0.2_1614019525068_0.055499788302234565"},"_hasShrinkwrap":false,"publish_time":1614019525242,"_cnpm_publish_time":1614019525242},"1.0.1":{"name":"globalthis","version":"1.0.1","author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"funding":{"url":"https://github.com/sponsors/ljharb"},"description":"ECMAScript spec-compliant polyfill/shim for `globalThis`","license":"MIT","main":"index.js","browser":{"./implementation":"./implementation.browser.js"},"scripts":{"pretest":"npm run --silent lint && es-shim-api --bound --property","test":"npm run --silent tests-only","posttest":"npx aud","tests-only":"npm run --silent test:implementation && npm run --silent test:shim","test:native":"node test/native.js","test:shim":"node test/shimmed.js","test:implementation":"node test/index.js","coverage":"covert test/*.js","coverage:quiet":"covert test/*.js --quiet","lint":"eslint .","build":"mkdir -p dist && browserify browserShim.js > dist/browser.js","prepublish":"npm run --silent build","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"repository":{"type":"git","url":"git://github.com/ljharb/System.global.git"},"keywords":["window","self","global","globalThis","System.global","global object","global this value","ECMAScript","es-shim API","polyfill","shim"],"dependencies":{"define-properties":"^1.1.3"},"devDependencies":{"@es-shims/api":"^2.1.2","@ljharb/eslint-config":"^15.0.2","auto-changelog":"^1.16.2","browserify":"^16.5.0","covert":"^1.1.1","eslint":"^6.7.2","for-each":"^0.3.3","is":"^3.3.0","tape":"^4.11.0"},"testling":{"files":"test/index.js","browsers":["iexplore/6.0..latest","firefox/3.0..6.0","firefox/15.0..latest","firefox/nightly","chrome/4.0..10.0","chrome/20.0..latest","chrome/canary","opera/10.0..latest","opera/next","safari/4.0..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2"]},"engines":{"node":">= 0.4"},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false},"gitHead":"de44cf7fcca3801c339df0ef3d19e1c40d9d09a2","bugs":{"url":"https://github.com/ljharb/System.global/issues"},"homepage":"https://github.com/ljharb/System.global#readme","_id":"globalthis@1.0.1","_nodeVersion":"13.3.0","_npmVersion":"6.13.1","dist":{"shasum":"40116f5d9c071f9e8fb0037654df1ab3a83b7ef9","size":8695,"noattachment":false,"key":"/globalthis/-/globalthis-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/globalthis/download/globalthis-1.0.1.tgz"},"maintainers":[{"name":"ljharb","email":""}],"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/globalthis_1.0.1_1576432296546_0.404246475618941"},"_hasShrinkwrap":false,"publish_time":1576432296683,"_cnpm_publish_time":1576432296683},"1.0.0":{"name":"globalthis","version":"1.0.0","author":{"name":"Jordan Harband"},"description":"ECMAScript spec-compliant polyfill/shim for `globalThis`","license":"MIT","main":"index.js","scripts":{"pretest":"npm run --silent lint && es-shim-api --bound --property","test":"npm run --silent tests-only","posttest":"npm run --silent security","tests-only":"npm run --silent test:implementation && npm run --silent test:shim","test:native":"node test/native.js","test:shim":"node test/shimmed.js","test:implementation":"node test/index.js","coverage":"covert test/*.js","coverage:quiet":"covert test/*.js --quiet","lint":"npm run --silent jscs && npm run --silent eslint","eslint":"eslint *.js test/*.js","jscs":"jscs *.js test/*.js","build":"mkdir -p dist && browserify browserShim.js > dist/browser.js","prepublish":"npm run --silent build","security":"nsp check"},"repository":{"type":"git","url":"git://github.com/ljharb/System.global.git"},"keywords":["window","self","global","globalThis","System.global","global object","global this value","ECMAScript","es-shim API","polyfill","shim"],"dependencies":{"define-properties":"^1.1.2","function-bind":"^1.1.1","object-keys":"^1.0.12"},"devDependencies":{"@es-shims/api":"^2.1.2","@ljharb/eslint-config":"^13.0.0","browserify":"^16.2.2","covert":"^1.1.0","eslint":"^5.3.0","for-each":"^0.3.3","is":"^3.2.1","jscs":"^3.0.7","nsp":"^3.2.1","tape":"^4.9.1"},"testling":{"files":"test/index.js","browsers":["iexplore/6.0..latest","firefox/3.0..6.0","firefox/15.0..latest","firefox/nightly","chrome/4.0..10.0","chrome/20.0..latest","chrome/canary","opera/10.0..latest","opera/next","safari/4.0..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2"]},"engines":{"node":">= 0.4"},"gitHead":"e3589972860b976b8ea8c324363b3a8145049f97","bugs":{"url":"https://github.com/ljharb/System.global/issues"},"homepage":"https://github.com/ljharb/System.global#readme","_id":"globalthis@1.0.0","_npmVersion":"6.2.0","_nodeVersion":"10.8.0","_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"dist":{"shasum":"c5fb98213a9b4595f59cf3e7074f141b4169daae","size":6416,"noattachment":false,"key":"/globalthis/-/globalthis-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/globalthis/download/globalthis-1.0.0.tgz"},"maintainers":[{"name":"ljharb","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/globalthis_1.0.0_1533886605843_0.9880878702697569"},"_hasShrinkwrap":false,"publish_time":1533886605922,"_cnpm_publish_time":1533886605922}},"readme":"# globalThis <sup>[![Version Badge][npm-version-svg]][npm-url]</sup>\n\n[![github actions][actions-image]][actions-url]\n[![coverage][codecov-image]][codecov-url]\n[![dependency status][deps-svg]][deps-url]\n[![dev dependency status][dev-deps-svg]][dev-deps-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[![npm badge][npm-badge-png]][npm-url]\n\nAn ECMAScript spec-compliant polyfill/shim for `globalThis`. Invoke its \"shim\" method to shim `globalThis` if it is unavailable.\n\nThis package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec proposal](https://github.com/tc39/proposal-global).\n\nMost common usage:\n```js\nvar globalThis = require('globalthis')(); // returns native globalThis if compliant\n\t/* or */\nvar globalThis = require('globalthis/polyfill')(); // returns native globalThis if compliant\n```\n\n## Example\n\n```js\nvar assert = require('assert');\n\n// the below function is not CSP-compliant, but reliably gets the\n// global object in sloppy mode in every engine.\nvar getGlobal = Function('return this');\n\nassert.equal(globalThis, getGlobal());\n```\n\n```js\n/* when `globalThis` is not present */\nvar shimmedGlobal = require('globalthis').shim();\n\t/* or */\nvar shimmedGlobal = require('globalthis/shim')();\n\nassert.equal(shimmedGlobal, globalThis);\nassert.equal(shimmedGlobal, getGlobal());\n```\n\n```js\n/* when `globalThis` is present */\nvar shimmedGlobal = require('globalthis').shim();\n\nassert.equal(shimmedGlobal, globalThis);\nassert.equal(shimmedGlobal, getGlobal());\n```\n\n## Tests\nSimply clone the repo, `npm install`, and run `npm test`\n\n[npm-url]: https://npmjs.org/package/globalthis\n[npm-version-svg]: https://versionbadg.es/ljharb/globalThis.svg\n[deps-svg]: https://david-dm.org/ljharb/globalThis.svg?theme=shields.io\n[deps-url]: https://david-dm.org/ljharb/globalThis\n[dev-deps-svg]: https://david-dm.org/ljharb/globalThis/dev-status.svg?theme=shields.io\n[dev-deps-url]: https://david-dm.org/ljharb/globalThis#info=devDependencies\n[npm-badge-png]: https://nodei.co/npm/globalthis.png?downloads=true&stars=true\n[license-image]: https://img.shields.io/npm/l/globalthis.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/globalthis.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=globalthis\n[codecov-image]: https://codecov.io/gh/es-shims/globalThis/branch/main/graphs/badge.svg\n[codecov-url]: https://app.codecov.io/gh/es-shims/globalThis/\n[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/globalThis\n[actions-url]: https://github.com/es-shims/globalThis/actions\n","_attachments":{},"homepage":"https://github.com/ljharb/System.global#readme","bugs":{"url":"https://github.com/ljharb/System.global/issues"},"license":"MIT"}