Methods

Sets a global variable.

  • Parameters:

    • key (string): The name of the global variable.

    • value (any): The value to be assigned to the global variable.

Gets the value of a global variable.

  • Parameters:

    • key (string): The name of the global variable.

  • Returns: The value of the global variable if it exists, otherwise undefined.

Updates an existing global variable by deeply merging new properties from the updates object into the current value associated with the specified key.

Parameters:

  • key (string): The name of the global variable to update. Must already exist.

  • updates (object): An object containing properties to merge into the current value. Supports deep merging.

Checks if a global variable exists.

  • Parameters:

    • key (string): The name of the global variable.

  • Returns: true if the global variable exists, otherwise false.

Deletes a global variable.

  • Parameters:

    • key (string): The name of the global variable.

  • Returns: true if the global variable was deleted, otherwise false.

Clears all user-defined global variables. Preserves essential global variables like global and process.

Last updated