Home Manual Reference Source Repository

Function

Static Public Summary
public

env(name: string, value: *): *

If only the name parameter is provided this function acts as a getter for process.env.

Static Public

public env(name: string, value: *): * source

If only the name parameter is provided this function acts as a getter for process.env. However if name and value are provide it acts as a setter for process.env. When acting as a getter the function will try to call JSON.parse() on the value cast to lowercase (to convert 'true' to true, 'TRUE' to true, '1' to 1, etc.) and if that fails it will return the value verbatim.

Params:

NameTypeAttributeDescription
name string

The envvar name to interact with.

value *
  • optional

If provided sets the value of the name envvar.

Return:

*

The parsed envvar value, regardless of if called as a getter or setter.

See: