globals
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
type-fest | 0.20.2 | 36.35 kB | (MIT OR CC0-1.0) | prod |
Globals is a compelling JavaScript package that provides an array of global identifiers from various JavaScript environments. The primary function of Globals is to serve as a comprehensive JSON file which can be utilized in any environment. Notably, it is widely employed by ESLint, a popular static code analysis tool, to flag any deviations in variable behavior based on their "read-only" or "overwritable" status. The Globals package is particularly renowned for its extensive inclusion of both Node.js built-in global identifiers and CommonJS arguments, enhancing its functionality and versatility.
The 'globals' package is conveniently user-friendly and can be installed and used seamlessly. To kickstart the process, you need to install the package using npm with the command npm install globals
. Post-installation, you can require 'globals' and utilize it in your JavaScript code. For instance,
const globals = require('globals');
console.log(globals.browser);
This code snippet will log an object containing browser-specific global identifiers from the 'globals' package. The boolean values associated with each global, indicating whether a global identifier is "read-only" (false
) or "overwritable" (true
), serve as flags for static analysis tools to check for any incorrect behaviors.
The comprehensive documentation for the 'globals' package can be accessed directly from the package's JSON file, found here. This JSON file contains a rich and useful collection of global identifiers from different JavaScript environments. More specific documentation, for instance, on the globals available on different platforms like Node.js or browser, can also be fetched from their respective official websites. Links to these resources are embedded in the provided JSON file.