v1.0.3 - 2022-05-07
npmignoreto autogenerate an npmignore file
globalThisshould be writable
prepublishOnlyscript for npm 7+
An ECMAScript spec-compliant polyfill/shim for
globalThis. Invoke its "shim" method to shim
globalThis if it is unavailable.
Most common usage:
var globalThis = require('globalthis')(); // returns native globalThis if compliant /* or */ var globalThis = require('globalthis/polyfill')(); // returns native globalThis if compliant
var assert = require('assert'); // the below function is not CSP-compliant, but reliably gets the // global object in sloppy mode in every engine. var getGlobal = Function('return this'); assert.equal(globalThis, getGlobal());
/* when `globalThis` is not present */ var shimmedGlobal = require('globalthis').shim(); /* or */ var shimmedGlobal = require('globalthis/shim')(); assert.equal(shimmedGlobal, globalThis); assert.equal(shimmedGlobal, getGlobal());
/* when `globalThis` is present */ var shimmedGlobal = require('globalthis').shim(); assert.equal(shimmedGlobal, globalThis); assert.equal(shimmedGlobal, getGlobal());
Simply clone the repo,
npm install, and run
ECMAScript spec-compliant polyfill/shim for `globalThis`
The npm package globalthis receives a total of 12,046,112 weekly downloads. As such, globalthis popularity was classified as popular.
We found that globalthis demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.
Did you know?
Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.