Home / Function/ parseEnvContent() — ui Function Reference

parseEnvContent() — ui Function Reference

Architecture documentation for the parseEnvContent() function in env-helpers.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  f6d1e24d_2a4b_80a5_233e_1b31060a0b05["parseEnvContent()"]
  6ea7c0f6_8e34_1742_bb2f_90e611bb6eda["env-helpers.ts"]
  f6d1e24d_2a4b_80a5_233e_1b31060a0b05 -->|defined in| 6ea7c0f6_8e34_1742_bb2f_90e611bb6eda
  7d02ce11_67d3_b526_0793_571de14db36b["getNewEnvKeys()"]
  7d02ce11_67d3_b526_0793_571de14db36b -->|calls| f6d1e24d_2a4b_80a5_233e_1b31060a0b05
  b18653bf_101d_ca3f_a9c5_a3788a04e629["mergeEnvContent()"]
  b18653bf_101d_ca3f_a9c5_a3788a04e629 -->|calls| f6d1e24d_2a4b_80a5_233e_1b31060a0b05
  style f6d1e24d_2a4b_80a5_233e_1b31060a0b05 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/utils/env-helpers.ts lines 34–60

export function parseEnvContent(content: string) {
  const lines = content.split("\n")
  const env: Record<string, string> = {}

  for (const line of lines) {
    const trimmed = line.trim()

    if (!trimmed || trimmed.startsWith("#")) {
      continue
    }

    // Find the first = and split there
    const equalIndex = trimmed.indexOf("=")
    if (equalIndex === -1) {
      continue
    }

    const key = trimmed.substring(0, equalIndex).trim()
    const value = trimmed.substring(equalIndex + 1).trim()

    if (key) {
      env[key] = value.replace(/^["']|["']$/g, "")
    }
  }

  return env
}

Subdomains

Frequently Asked Questions

What does parseEnvContent() do?
parseEnvContent() is a function in the ui codebase, defined in packages/shadcn/src/utils/env-helpers.ts.
Where is parseEnvContent() defined?
parseEnvContent() is defined in packages/shadcn/src/utils/env-helpers.ts at line 34.
What calls parseEnvContent()?
parseEnvContent() is called by 2 function(s): getNewEnvKeys, mergeEnvContent.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free