Home / Function/ isValidThemeTuple() — tailwindcss Function Reference

isValidThemeTuple() — tailwindcss Function Reference

Architecture documentation for the isValidThemeTuple() function in apply-config-to-theme.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  3c4c3fa1_3dc8_df16_2245_0aed0adc55f6["isValidThemeTuple()"]
  245c850a_c551_a2cf_854e_bba95b5a1339["apply-config-to-theme.ts"]
  3c4c3fa1_3dc8_df16_2245_0aed0adc55f6 -->|defined in| 245c850a_c551_a2cf_854e_bba95b5a1339
  f0444c59_74bb_21c0_b8e1_c65ad667fa51["themeableValues()"]
  f0444c59_74bb_21c0_b8e1_c65ad667fa51 -->|calls| 3c4c3fa1_3dc8_df16_2245_0aed0adc55f6
  style 3c4c3fa1_3dc8_df16_2245_0aed0adc55f6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/compat/apply-config-to-theme.ts lines 246–265

function isValidThemeTuple(value: unknown): value is [string, Record<string, string | number>] {
  // Check for tuple values of the form
  // `[string, Record<string, string | number>]`
  if (!Array.isArray(value)) return false
  if (value.length !== 2) return false

  // A string or number as the "value"
  if (typeof value[0] !== 'string' && typeof value[0] !== 'number') return false

  // An object as the nested theme values
  if (value[1] === undefined || value[1] === null) return false
  if (typeof value[1] !== 'object') return false

  for (let key of Reflect.ownKeys(value[1])) {
    if (typeof key !== 'string') return false
    if (typeof value[1][key] !== 'string' && typeof value[1][key] !== 'number') return false
  }

  return true
}

Subdomains

Called By

Frequently Asked Questions

What does isValidThemeTuple() do?
isValidThemeTuple() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/compat/apply-config-to-theme.ts.
Where is isValidThemeTuple() defined?
isValidThemeTuple() is defined in packages/tailwindcss/src/compat/apply-config-to-theme.ts at line 246.
What calls isValidThemeTuple()?
isValidThemeTuple() is called by 1 function(s): themeableValues.

Analyze Your Own Codebase

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

Try Supermodel Free