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
  d6d83ab5_c81e_09c3_c363_436dc65efd9b["isValidThemeTuple()"]
  303b7e7d_33cb_6a63_7591_f61feb3c4e3d["themeableValues()"]
  303b7e7d_33cb_6a63_7591_f61feb3c4e3d -->|calls| d6d83ab5_c81e_09c3_c363_436dc65efd9b
  style d6d83ab5_c81e_09c3_c363_436dc65efd9b 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.
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