Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/node-core-library > EnvironmentMap

EnvironmentMap class

A map data structure that stores process environment variables. On Windows operating system, the variable names are case-insensitive.

Signature:

export declare class EnvironmentMap 

Constructors

ConstructorModifiersDescription
(constructor)(environmentObject)Constructs a new instance of the EnvironmentMap class

Properties

PropertyModifiersTypeDescription
caseSensitivereadonlybooleanWhether the environment variable names are case-sensitive.

Methods

MethodModifiersDescription
clear()Clears all entries, resulting in an empty map.
entries()Returns the map entries.
get(name)Returns the value of the specified variable, or undefined if the map does not contain that name.
mergeFrom(environmentMap)Adds each entry from environmentMap to this map.
mergeFromObject(environmentObject)Merges entries from a plain JavaScript object, such as would be used with the process.env API.
names()Returns the map keys, which are environment variable names.
set(name, value)Assigns the variable to the specified value. A previous value will be overwritten.
toObject()Returns the keys as a plain JavaScript object similar to the object returned by the process.env API.
unset(name)Removes the key from the map, if present.