Home / Function/ convert() — tailwindcss Function Reference

convert() — tailwindcss Function Reference

Architecture documentation for the convert() function in args.ts from the tailwindcss codebase.

Function typescript TailwindCLI Commands calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  359da765_1362_c567_526a_4df917dfc8a5["convert()"]
  7a35edd3_d8ea_53d4_d70a_484e9e5c4da5["args()"]
  7a35edd3_d8ea_53d4_d70a_484e9e5c4da5 -->|calls| 359da765_1362_c567_526a_4df917dfc8a5
  f2477717_2be8_c0e7_24b8_abf76f276d06["convertString()"]
  359da765_1362_c567_526a_4df917dfc8a5 -->|calls| f2477717_2be8_c0e7_24b8_abf76f276d06
  fab5f786_d20c_02a4_834c_ab5163bb13d6["convertBoolean()"]
  359da765_1362_c567_526a_4df917dfc8a5 -->|calls| fab5f786_d20c_02a4_834c_ab5163bb13d6
  51bf53c7_2f20_55dd_fb8c_993beec2ac8d["convertNumber()"]
  359da765_1362_c567_526a_4df917dfc8a5 -->|calls| 51bf53c7_2f20_55dd_fb8c_993beec2ac8d
  style 359da765_1362_c567_526a_4df917dfc8a5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-cli/src/utils/args.ts lines 131–150

function convert<T extends keyof Types>(value: string | boolean, type: T) {
  switch (type) {
    case 'string':
      return convertString(value)
    case 'boolean':
      return convertBoolean(value)
    case 'number':
      return convertNumber(value)
    case 'boolean | string':
      return convertBoolean(value) ?? convertString(value)
    case 'number | string':
      return convertNumber(value) ?? convertString(value)
    case 'boolean | number':
      return convertBoolean(value) ?? convertNumber(value)
    case 'boolean | number | string':
      return convertBoolean(value) ?? convertNumber(value) ?? convertString(value)
    default:
      throw new Error(`Unhandled type: ${type}`)
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does convert() do?
convert() is a function in the tailwindcss codebase.
What does convert() call?
convert() calls 3 function(s): convertBoolean, convertNumber, convertString.
What calls convert()?
convert() is called by 1 function(s): args.

Analyze Your Own Codebase

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

Try Supermodel Free