Parse .env file output in an object.
.env
Note: The key needs to match the pattern /^[a-zA-Z_][a-zA-Z0-9_]*$/.
The text to parse.
The parsed object.
import { parse } from "@std/dotenv/parse";import { assertEquals } from "@std/assert";const env = parse("GREETING=hello world");assertEquals(env, { GREETING: "hello world" }); Copy
import { parse } from "@std/dotenv/parse";import { assertEquals } from "@std/assert";const env = parse("GREETING=hello world");assertEquals(env, { GREETING: "hello world" });
Parse
.envfile output in an object.Note: The key needs to match the pattern /^[a-zA-Z_][a-zA-Z0-9_]*$/.