Home / Function/ convert() — tailwindcss Function Reference

convert() — tailwindcss Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  382bc4ab_bcb1_540f_cb5e_34b04e8f7c13["convert()"]
  6609540e_7b3a_6cb0_544d_ad0926f240d4["args()"]
  6609540e_7b3a_6cb0_544d_ad0926f240d4 -->|calls| 382bc4ab_bcb1_540f_cb5e_34b04e8f7c13
  3ee308c6_145c_6839_5275_17fecf38c146["convertString()"]
  382bc4ab_bcb1_540f_cb5e_34b04e8f7c13 -->|calls| 3ee308c6_145c_6839_5275_17fecf38c146
  bb470bd2_11cb_72ec_0a93_339ae80622ef["convertBoolean()"]
  382bc4ab_bcb1_540f_cb5e_34b04e8f7c13 -->|calls| bb470bd2_11cb_72ec_0a93_339ae80622ef
  39df6578_6551_720c_ab53_b82ac5b3c299["convertNumber()"]
  382bc4ab_bcb1_540f_cb5e_34b04e8f7c13 -->|calls| 39df6578_6551_720c_ab53_b82ac5b3c299
  style 382bc4ab_bcb1_540f_cb5e_34b04e8f7c13 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-upgrade/src/utils/args.ts lines 110–129

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