Function parse

  • Parse .env file output in an object.

    Note: The key needs to match the pattern /^[a-zA-Z_][a-zA-Z0-9_]*$/.

    Parameters

    • text: string

      The text to parse.

    Returns Record<string, string>

    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" });