Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 16, 2024 via pnpm

globalthis 1.0.3

ECMAScript spec-compliant polyfill/shim for `globalThis`
Package summary
Share
0
issues
1
license
13
MIT
Package created
10 Aug 2018
Version published
7 May 2022
Maintainers
1
Total deps
13
Direct deps
1
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
13 Packages, Including:
define-data-property@1.1.4
define-properties@1.2.1
es-define-property@1.0.0
es-errors@1.3.0
function-bind@1.1.2
get-intrinsic@1.2.4
globalthis@1.0.3
gopd@1.0.1
has-property-descriptors@1.0.2
has-proto@1.0.3
has-symbols@1.0.3
hasown@2.0.2
object-keys@1.1.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of globalthis 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
define-properties1.2.15.08 kBMIT
prod

Visualizations

Frequently Asked Questions

What does globalthis do?

The globalThis is an ECMAScript spec-compliant polyfill/shim package. It aims to provide a reliable and consistent reference to the global object, which is globalThis in JavaScript, across all different environments. The globalThis achieves this by providing a shim method. This method allows globalThis, if unavailable, to be shimmed or replaced.

How do you use globalthis?

To use globalThis, you will need to require the package in your project. Here are some examples of how to use it in your code:

// Returns native globalThis if compliant
var globalThis = require('globalthis')(); 

// Alternatively, you can also use the polyfill
var globalThis = require('globalthis/polyfill')(); 

/* 
  When `globalThis` is not present, you can use the shim method
  This ensures that `globalThis` is available across all environments
*/
var shimmedGlobal = require('globalthis').shim(); 

// And using the shim from a different path
var shimmedGlobal = require('globalthis/shim')();

Remember, these lines of code return a reference to the global this object, ensuring that globalThis is available in your code, no matter what environment you're running it in.

Where are the globalthis docs?

The globalThis package documents are available on Github. You can access more detailed documentation and usage examples by visiting the repository's readme file at this address: git://github.com/ljharb/System.global.git. From here, you can learn more about the package, including its implementation of the es-shim API interface, its usage in an ES3-supported environment, and its compliance with the spec proposal. The readme also provides various usage examples for the globalThis package, as well as its tests. Regularly visiting this address will keep you updated on any changes or updates to the globalThis package.