Home / Function/ shouldIncludeHeader() — ui Function Reference

shouldIncludeHeader() — ui Function Reference

Architecture documentation for the shouldIncludeHeader() function in builder.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  75451fd7_c8ee_e421_be7d_1502ed1677f4["shouldIncludeHeader()"]
  8c5b2947_9033_b37b_2596_f9777d2a7f77["builder.ts"]
  75451fd7_c8ee_e421_be7d_1502ed1677f4 -->|defined in| 8c5b2947_9033_b37b_2596_f9777d2a7f77
  67a74cd4_d18f_78b8_c357_210cbfc4e92a["buildHeadersFromRegistryConfig()"]
  67a74cd4_d18f_78b8_c357_210cbfc4e92a -->|calls| 75451fd7_c8ee_e421_be7d_1502ed1677f4
  style 75451fd7_c8ee_e421_be7d_1502ed1677f4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/registry/builder.ts lines 120–140

function shouldIncludeHeader(originalValue: string, expandedValue: string) {
  const trimmedExpanded = expandedValue.trim()

  if (!trimmedExpanded) {
    return false
  }

  // If the original value contains valid env vars, only include if expansion changed the value.
  if (originalValue.includes("${")) {
    // Check if there are actual env vars in the string
    const envVars = originalValue.match(ENV_VAR_PATTERN)
    if (envVars) {
      const templateWithoutVars = originalValue
        .replace(ENV_VAR_PATTERN, "")
        .trim()
      return trimmedExpanded !== templateWithoutVars
    }
  }

  return true
}

Subdomains

Frequently Asked Questions

What does shouldIncludeHeader() do?
shouldIncludeHeader() is a function in the ui codebase, defined in packages/shadcn/src/registry/builder.ts.
Where is shouldIncludeHeader() defined?
shouldIncludeHeader() is defined in packages/shadcn/src/registry/builder.ts at line 120.
What calls shouldIncludeHeader()?
shouldIncludeHeader() is called by 1 function(s): buildHeadersFromRegistryConfig.

Analyze Your Own Codebase

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

Try Supermodel Free