Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/deno/cli/js/deno.ts>env

A modern runtime for JavaScript and TypeScript.
Go to Latest
function env
import { env } from "https://deno.land/x/deno@v0.30.0/cli/js/deno.ts";

Returns a snapshot of the environment variables at invocation. Mutating a property in the object will set that variable in the environment for the process. The environment object will only accept strings as values.

  console.log(Deno.env("SHELL"));
  const myEnv = Deno.env();
  console.log(myEnv.SHELL);
  myEnv.TEST_VAR = "HELLO";
  const newEnv = Deno.env();
  console.log(myEnv.TEST_VAR == newEnv.TEST_VAR);

Returns

{ [index: string]: string; }

Parameters

key: string

Returns

string | undefined