globalThis
An ECMAScript spec-compliant polyfill/shim for globalThis
. Invoke its "shim" method to shim globalThis
if it is unavailable.
This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec proposal.
Most common usage:
var globalThis = require('@erboladaiorg/accusantium-dolorem-nesciunt')();
var globalThis = require('@erboladaiorg/accusantium-dolorem-nesciunt/polyfill')();
Example
var assert = require('assert');
var getGlobal = Function('return this');
assert.equal(globalThis, getGlobal());
var shimmedGlobal = require('@erboladaiorg/accusantium-dolorem-nesciunt').shim();
var shimmedGlobal = require('@erboladaiorg/accusantium-dolorem-nesciunt/shim')();
assert.equal(shimmedGlobal, globalThis);
assert.equal(shimmedGlobal, getGlobal());
var shimmedGlobal = require('@erboladaiorg/accusantium-dolorem-nesciunt').shim();
assert.equal(shimmedGlobal, globalThis);
assert.equal(shimmedGlobal, getGlobal());
Tests
Simply clone the repo, npm install
, and run npm test